@graphpilot-oss/graphpilot 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +15 -0
- package/.github/CODEOWNERS +22 -0
- package/.github/FUNDING.yml +1 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +33 -0
- package/.github/ISSUE_TEMPLATE/config.yml +5 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +23 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +19 -0
- package/.github/dependabot.yml +15 -0
- package/.github/workflows/ci.yml +62 -0
- package/.github/workflows/release.yml +50 -0
- package/.prettierignore +19 -0
- package/.prettierrc.json +20 -0
- package/CHANGELOG.md +138 -0
- package/CODE_OF_CONDUCT.md +83 -0
- package/CONTRIBUTING.md +111 -0
- package/LICENSE +201 -0
- package/README.md +132 -0
- package/SECURITY.md +44 -0
- package/assets/logo.png +0 -0
- package/assets/logo.svg +1 -0
- package/bench/README.md +544 -0
- package/bench/results/agent-tier-2026-05-22.md +28 -0
- package/bench/results/agent-tier-summary.md +44 -0
- package/bench/results/baseline-tier-2026-05-22.md +23 -0
- package/bench/results/baseline.json +810 -0
- package/bench/results/baseline.md +28 -0
- package/bench/run-agent-tier-automated.ts +234 -0
- package/bench/run-agent-tier.md +125 -0
- package/bench/run-baseline-tier.ts +200 -0
- package/bench/run.ts +210 -0
- package/bench/runner-baseline.ts +177 -0
- package/bench/runner-graphpilot.ts +131 -0
- package/bench/score-agent-tier.ts +191 -0
- package/bench/score.ts +59 -0
- package/bench/tasks.ts +236 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +162 -0
- package/dist/cli.js.map +1 -0
- package/dist/edges.d.ts +57 -0
- package/dist/edges.js +170 -0
- package/dist/edges.js.map +1 -0
- package/dist/git.d.ts +95 -0
- package/dist/git.js +247 -0
- package/dist/git.js.map +1 -0
- package/dist/graph-schema.d.ts +36 -0
- package/dist/graph-schema.js +208 -0
- package/dist/graph-schema.js.map +1 -0
- package/dist/impact.d.ts +99 -0
- package/dist/impact.js +123 -0
- package/dist/impact.js.map +1 -0
- package/dist/indexer.d.ts +28 -0
- package/dist/indexer.js +111 -0
- package/dist/indexer.js.map +1 -0
- package/dist/interactions.d.ts +46 -0
- package/dist/interactions.js +0 -0
- package/dist/interactions.js.map +1 -0
- package/dist/mcp.d.ts +3 -0
- package/dist/mcp.js +567 -0
- package/dist/mcp.js.map +1 -0
- package/dist/parser.d.ts +24 -0
- package/dist/parser.js +128 -0
- package/dist/parser.js.map +1 -0
- package/dist/provenance.d.ts +74 -0
- package/dist/provenance.js +95 -0
- package/dist/provenance.js.map +1 -0
- package/dist/query.d.ts +68 -0
- package/dist/query.js +127 -0
- package/dist/query.js.map +1 -0
- package/dist/redact.d.ts +30 -0
- package/dist/redact.js +117 -0
- package/dist/redact.js.map +1 -0
- package/dist/storage.d.ts +42 -0
- package/dist/storage.js +85 -0
- package/dist/storage.js.map +1 -0
- package/dist/symbols.d.ts +20 -0
- package/dist/symbols.js +140 -0
- package/dist/symbols.js.map +1 -0
- package/dist/validation.d.ts +9 -0
- package/dist/validation.js +65 -0
- package/dist/validation.js.map +1 -0
- package/dist/validators.d.ts +55 -0
- package/dist/validators.js +205 -0
- package/dist/validators.js.map +1 -0
- package/dist/watcher.d.ts +86 -0
- package/dist/watcher.js +310 -0
- package/dist/watcher.js.map +1 -0
- package/docs/architecture.md +311 -0
- package/docs/limitations.md +156 -0
- package/docs/mcp-setup.md +231 -0
- package/docs/quickstart.md +202 -0
- package/eslint.config.js +148 -0
- package/lefthook.yml +81 -0
- package/package.json +56 -0
- package/pnpm-workspace.yaml +6 -0
- package/scripts/smoke-stdio.mjs +97 -0
- package/src/cli.ts +171 -0
- package/src/edges.ts +202 -0
- package/src/git.ts +255 -0
- package/src/graph-schema.ts +229 -0
- package/src/impact.ts +218 -0
- package/src/indexer.ts +152 -0
- package/src/interactions.ts +0 -0
- package/src/mcp.ts +652 -0
- package/src/parser.ts +138 -0
- package/src/provenance.ts +115 -0
- package/src/query.ts +148 -0
- package/src/redact.ts +122 -0
- package/src/storage.ts +115 -0
- package/src/symbols.ts +173 -0
- package/src/validation.ts +69 -0
- package/src/validators.ts +253 -0
- package/src/watcher.ts +383 -0
- package/tests/edges.test.ts +175 -0
- package/tests/fixtures/sample.ts +32 -0
- package/tests/git.test.ts +303 -0
- package/tests/graph-schema.test.ts +321 -0
- package/tests/impact.test.ts +454 -0
- package/tests/interactions.test.ts +180 -0
- package/tests/lint-policy.test.ts +106 -0
- package/tests/mcp-stdio.test.ts +171 -0
- package/tests/mcp.test.ts +335 -0
- package/tests/parser.test.ts +31 -0
- package/tests/provenance.test.ts +132 -0
- package/tests/query.test.ts +160 -0
- package/tests/redact.test.ts +167 -0
- package/tests/security.test.ts +144 -0
- package/tests/symbols.test.ts +78 -0
- package/tests/validators.test.ts +193 -0
- package/tests/watcher.test.ts +250 -0
- package/tsconfig.json +18 -0
package/.editorconfig
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# CODEOWNERS — auto-request review on every PR.
|
|
2
|
+
#
|
|
3
|
+
# Syntax: <path-glob> <reviewer> [<reviewer>...]
|
|
4
|
+
# Reviewers are GitHub handles (no @) or team slugs (@org/team).
|
|
5
|
+
#
|
|
6
|
+
# Order matters: the LAST matching rule wins. Default rule first, then
|
|
7
|
+
# overrides for paths that should pull in specific reviewers.
|
|
8
|
+
#
|
|
9
|
+
# Docs: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-security/customizing-your-repository/about-code-owners
|
|
10
|
+
|
|
11
|
+
# Default: solo maintainer reviews everything.
|
|
12
|
+
* @codeakki
|
|
13
|
+
|
|
14
|
+
# When co-maintainers join, add area-specific rules. For example:
|
|
15
|
+
#
|
|
16
|
+
# /src/mcp/ @codeakki @some-mcp-expert
|
|
17
|
+
# /src/parser/ @codeakki @some-tree-sitter-expert
|
|
18
|
+
# /docs/ @codeakki @docs-lead
|
|
19
|
+
# /bench/ @codeakki @benchmark-owner
|
|
20
|
+
# /.github/ @codeakki # workflow changes are sensitive
|
|
21
|
+
#
|
|
22
|
+
# Until then, the default rule is enough.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
github: [codeakki]
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Something is broken or behaving unexpectedly
|
|
4
|
+
title: 'bug: '
|
|
5
|
+
labels: bug
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Describe the bug
|
|
9
|
+
|
|
10
|
+
A clear description of what's wrong.
|
|
11
|
+
|
|
12
|
+
## Reproduction
|
|
13
|
+
|
|
14
|
+
Steps to reproduce:
|
|
15
|
+
|
|
16
|
+
1. Run `...`
|
|
17
|
+
2. ...
|
|
18
|
+
3. ...
|
|
19
|
+
|
|
20
|
+
## Expected behavior
|
|
21
|
+
|
|
22
|
+
What you expected to happen instead.
|
|
23
|
+
|
|
24
|
+
## Environment
|
|
25
|
+
|
|
26
|
+
- OS: [macOS / Linux / Windows + version]
|
|
27
|
+
- Node version: output of `node -v`
|
|
28
|
+
- GraphPilot version: output of `node dist/cli.js --version` (or commit SHA)
|
|
29
|
+
- MCP client (if relevant): [Claude Code / Cursor / Windsurf / ...]
|
|
30
|
+
|
|
31
|
+
## Additional context
|
|
32
|
+
|
|
33
|
+
Logs, screenshots, or a minimal repo that reproduces the issue.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest a new feature or improvement
|
|
4
|
+
title: 'feat: '
|
|
5
|
+
labels: enhancement
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## What problem does this solve?
|
|
9
|
+
|
|
10
|
+
Describe the real-world task or pain point that motivates this feature.
|
|
11
|
+
"My coding agent struggles with X" is more useful than "GraphPilot should support X."
|
|
12
|
+
|
|
13
|
+
## Proposed solution
|
|
14
|
+
|
|
15
|
+
What you'd like to see. Rough sketch is fine.
|
|
16
|
+
|
|
17
|
+
## Alternatives considered
|
|
18
|
+
|
|
19
|
+
What workarounds have you tried? Any other tools that solve this well?
|
|
20
|
+
|
|
21
|
+
## Additional context
|
|
22
|
+
|
|
23
|
+
Links, screenshots, examples.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
## What
|
|
2
|
+
|
|
3
|
+
Brief description of the change.
|
|
4
|
+
|
|
5
|
+
## Why
|
|
6
|
+
|
|
7
|
+
What problem does this solve? Link to issue: closes #...
|
|
8
|
+
|
|
9
|
+
## How
|
|
10
|
+
|
|
11
|
+
Brief explanation of the approach. Anything reviewers should look at carefully?
|
|
12
|
+
|
|
13
|
+
## Checklist
|
|
14
|
+
|
|
15
|
+
- [ ] Tests added/updated
|
|
16
|
+
- [ ] Documentation updated if user-facing behavior changed
|
|
17
|
+
- [ ] `CHANGELOG.md` updated under `[Unreleased]`
|
|
18
|
+
- [ ] CI passes (`pnpm build && pnpm test`)
|
|
19
|
+
- [ ] Commit message follows [Conventional Commits](https://www.conventionalcommits.org)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: npm
|
|
4
|
+
directory: '/'
|
|
5
|
+
schedule:
|
|
6
|
+
interval: weekly
|
|
7
|
+
open-pull-requests-limit: 5
|
|
8
|
+
groups:
|
|
9
|
+
dev-dependencies:
|
|
10
|
+
dependency-type: development
|
|
11
|
+
|
|
12
|
+
- package-ecosystem: github-actions
|
|
13
|
+
directory: '/'
|
|
14
|
+
schedule:
|
|
15
|
+
interval: monthly
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
lint:
|
|
10
|
+
name: lint (ESLint — enforces no-network in src/, T12)
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v6
|
|
14
|
+
- uses: pnpm/action-setup@v6
|
|
15
|
+
- uses: actions/setup-node@v6
|
|
16
|
+
with:
|
|
17
|
+
node-version: 22
|
|
18
|
+
cache: pnpm
|
|
19
|
+
- run: pnpm install --frozen-lockfile
|
|
20
|
+
- run: pnpm typecheck
|
|
21
|
+
- run: pnpm lint
|
|
22
|
+
|
|
23
|
+
test:
|
|
24
|
+
name: test (${{ matrix.os }}, node ${{ matrix.node }})
|
|
25
|
+
needs: lint
|
|
26
|
+
strategy:
|
|
27
|
+
fail-fast: false
|
|
28
|
+
matrix:
|
|
29
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
30
|
+
node: [20, 22]
|
|
31
|
+
runs-on: ${{ matrix.os }}
|
|
32
|
+
steps:
|
|
33
|
+
- uses: actions/checkout@v6
|
|
34
|
+
|
|
35
|
+
- uses: pnpm/action-setup@v6
|
|
36
|
+
|
|
37
|
+
- uses: actions/setup-node@v6
|
|
38
|
+
with:
|
|
39
|
+
node-version: ${{ matrix.node }}
|
|
40
|
+
cache: pnpm
|
|
41
|
+
|
|
42
|
+
- name: Install dependencies
|
|
43
|
+
run: pnpm install --frozen-lockfile
|
|
44
|
+
|
|
45
|
+
- name: Build
|
|
46
|
+
run: pnpm build
|
|
47
|
+
|
|
48
|
+
- name: Test
|
|
49
|
+
run: pnpm test
|
|
50
|
+
|
|
51
|
+
audit:
|
|
52
|
+
name: audit
|
|
53
|
+
runs-on: ubuntu-latest
|
|
54
|
+
steps:
|
|
55
|
+
- uses: actions/checkout@v6
|
|
56
|
+
- uses: pnpm/action-setup@v6
|
|
57
|
+
- uses: actions/setup-node@v6
|
|
58
|
+
with:
|
|
59
|
+
node-version: 22
|
|
60
|
+
cache: pnpm
|
|
61
|
+
- run: pnpm install --frozen-lockfile
|
|
62
|
+
- run: pnpm audit --audit-level=high
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
id-token: write
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
publish:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v6
|
|
17
|
+
|
|
18
|
+
- uses: pnpm/action-setup@v6
|
|
19
|
+
|
|
20
|
+
- uses: actions/setup-node@v6
|
|
21
|
+
with:
|
|
22
|
+
node-version: 22
|
|
23
|
+
cache: pnpm
|
|
24
|
+
registry-url: 'https://registry.npmjs.org'
|
|
25
|
+
|
|
26
|
+
- run: pnpm install --frozen-lockfile
|
|
27
|
+
|
|
28
|
+
- run: pnpm run check
|
|
29
|
+
|
|
30
|
+
- run: pnpm build
|
|
31
|
+
|
|
32
|
+
# Test tags (e.g. v0.0.1-test) publish under --tag test, not latest
|
|
33
|
+
- name: Publish (test tag)
|
|
34
|
+
if: contains(github.ref_name, '-test')
|
|
35
|
+
run: pnpm publish --no-git-checks --tag test
|
|
36
|
+
env:
|
|
37
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
38
|
+
|
|
39
|
+
# Real releases publish normally with provenance
|
|
40
|
+
- name: Publish (release)
|
|
41
|
+
if: "!contains(github.ref_name, '-test')"
|
|
42
|
+
run: pnpm publish --no-git-checks --provenance
|
|
43
|
+
env:
|
|
44
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
45
|
+
|
|
46
|
+
# Only create a GitHub Release for real tags, not test ones
|
|
47
|
+
- uses: softprops/action-gh-release@v3
|
|
48
|
+
if: "!contains(github.ref_name, '-test')"
|
|
49
|
+
with:
|
|
50
|
+
generate_release_notes: true
|
package/.prettierignore
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Don't reformat:
|
|
2
|
+
node_modules/
|
|
3
|
+
dist/
|
|
4
|
+
coverage/
|
|
5
|
+
|
|
6
|
+
# Lockfiles + generated data are not human-edited.
|
|
7
|
+
pnpm-lock.yaml
|
|
8
|
+
package-lock.json
|
|
9
|
+
yarn.lock
|
|
10
|
+
|
|
11
|
+
# Benchmark output is generated by `pnpm bench` — prettier would
|
|
12
|
+
# pointlessly reformat the JSON every run.
|
|
13
|
+
bench/results/
|
|
14
|
+
|
|
15
|
+
# Private notes are not part of the project, don't touch.
|
|
16
|
+
.notes/
|
|
17
|
+
|
|
18
|
+
# CLAUDE.md is per-developer + gitignored, leave alone.
|
|
19
|
+
CLAUDE.md
|
package/.prettierrc.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"semi": true,
|
|
3
|
+
"singleQuote": true,
|
|
4
|
+
"trailingComma": "all",
|
|
5
|
+
"printWidth": 100,
|
|
6
|
+
"tabWidth": 2,
|
|
7
|
+
"useTabs": false,
|
|
8
|
+
"arrowParens": "always",
|
|
9
|
+
"endOfLine": "lf",
|
|
10
|
+
"bracketSpacing": true,
|
|
11
|
+
"overrides": [
|
|
12
|
+
{
|
|
13
|
+
"files": "*.md",
|
|
14
|
+
"options": {
|
|
15
|
+
"proseWrap": "preserve",
|
|
16
|
+
"printWidth": 80
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Evidence anchors** on every MCP tool response. Symbol records and call
|
|
13
|
+
edges now carry a `file:line @ <short-sha>` provenance tag inline so the
|
|
14
|
+
agent can quote a verifiable reference. Backed by `src/provenance.ts` and
|
|
15
|
+
pure-fs git helpers in `src/git.ts` (no `child_process` — T6-safe). The
|
|
16
|
+
graph schema gained two optional fields, `indexedSha` and `indexedBranch`,
|
|
17
|
+
populated at index time when the root is inside a git worktree. Old graphs
|
|
18
|
+
load unchanged.
|
|
19
|
+
- **Differential impact:** `gp_impact` now accepts `since: <commit|tag|branch>`.
|
|
20
|
+
When set, the returned callers (direct + transitive) are filtered to files
|
|
21
|
+
changed between that ref and HEAD — ideal for PR-scoped refactor review
|
|
22
|
+
("of every caller of X, which ones does my branch actually touch?"). Diff
|
|
23
|
+
computation runs through `isomorphic-git`; pure JS, no shell-out.
|
|
24
|
+
- **Worktree-scoped indexing.** `graphpilot index ./src/feature` and the
|
|
25
|
+
`gp_index` MCP tool auto-resolve to the git worktree top when called from
|
|
26
|
+
a subdirectory, so two `git worktree add`-ed branches naturally produce
|
|
27
|
+
two separate indexes. Pass `--no-worktree` to opt out and index a subdir
|
|
28
|
+
directly.
|
|
29
|
+
- Repositioned the README around the "refactor-safe code graph" framing —
|
|
30
|
+
evidence-backed, branch-aware, worktree-native.
|
|
31
|
+
- Initial project scaffold (Node.js + TypeScript)
|
|
32
|
+
- Tree-sitter-based parser for TS/TSX/JS/JSX
|
|
33
|
+
- Symbol extraction for functions, classes, methods, interfaces, type aliases, enums
|
|
34
|
+
- Directory indexer with sensible default ignores (node_modules, dist, .d.ts, etc.)
|
|
35
|
+
- JSON storage at `~/.graphpilot/<repo-id>/graph.json`
|
|
36
|
+
- CLI: `graphpilot index <path>`, `graphpilot status <path>`, `graphpilot mcp`
|
|
37
|
+
- Call-edge extraction (`gp_callers` precursor): captures every call/new
|
|
38
|
+
expression inside a function body, attributes it to the immediate enclosing
|
|
39
|
+
function, and resolves the target across the indexed symbol table.
|
|
40
|
+
- Outputs include both resolved (`toId` set) and unresolved (`toName` only) edges
|
|
41
|
+
so the agent can still see stdlib/external calls.
|
|
42
|
+
- Query layer (`GraphIndex`): pre-computed lookup tables for findByName,
|
|
43
|
+
findById, callers, callees. Sub-millisecond lookups on indexed repos.
|
|
44
|
+
- MCP server over stdio (`@modelcontextprotocol/sdk`). Tool surface:
|
|
45
|
+
- `gp_stats` — index health probe
|
|
46
|
+
- `gp_index` — re-index a repo from the agent
|
|
47
|
+
- `gp_recall` — find symbols by name (exact CI by default, substring opt-in)
|
|
48
|
+
- `gp_callers` — list callers or callees (with direction param)
|
|
49
|
+
- `gp_impact` — blast-radius analysis: direct callers, transitive
|
|
50
|
+
callers (BFS, depth 1–5), tests likely affected (heuristic on file
|
|
51
|
+
paths), and a public-API flag derived from `exported`. Answers "what
|
|
52
|
+
breaks if I rename X?" in a single tool call. Pure-function core in
|
|
53
|
+
`src/impact.ts`; cycle-safe; per-level cap with `truncated` flag.
|
|
54
|
+
- Watch mode: `graphpilot watch <path>` keeps the index fresh as you
|
|
55
|
+
edit. Uses `chokidar` (fsevents/inotify/RDCW) with editor-save
|
|
56
|
+
debouncing. Each file save triggers an incremental update — re-parse
|
|
57
|
+
one file, drop its old contribution, re-resolve edges across the
|
|
58
|
+
whole symbol table, save atomically. Real-world 3–5 ms per save on
|
|
59
|
+
small repos. Updates serialize through an internal chain so chokidar
|
|
60
|
+
bursts can't race into a torn graph. Storage writes are atomic
|
|
61
|
+
(`.tmp` + rename) so a crash never leaves a half-written graph.json.
|
|
62
|
+
CLI runs until SIGINT.
|
|
63
|
+
- Reproducible benchmark (Tier A): `pnpm bench` runs 10 hand-curated
|
|
64
|
+
structural tasks against GraphPilot's own codebase (the corpus) and
|
|
65
|
+
scores precision/recall/F1 + bytes processed vs a grep-simulator
|
|
66
|
+
baseline. Anyone with `pnpm install` can reproduce. First run:
|
|
67
|
+
**F1 0.89 vs grep 0.42, 99.9 % byte reduction (721 B vs 528 KB),
|
|
68
|
+
7 wins / 2 ties / 1 expected loss** (the string-literal task,
|
|
69
|
+
deliberately included as the honest "grep wins" case). Spec for the
|
|
70
|
+
agent-eval Tier B is in `bench/run-agent-tier.md`.
|
|
71
|
+
- Contributor Covenant 2.1 code of conduct (closes GitHub Community
|
|
72
|
+
Standards check). Reporting email is `codewithakki@gmail.com`;
|
|
73
|
+
|
|
74
|
+
### Dev workflow
|
|
75
|
+
|
|
76
|
+
- Pre-commit hooks via `lefthook` (added 2026-05-20):
|
|
77
|
+
- `pre-commit`: `pnpm typecheck` + ESLint + `prettier --check` on
|
|
78
|
+
staged source files (parallel). Hits sub-second on small changes.
|
|
79
|
+
- `commit-msg`: Conventional Commits regex enforcement. Bad messages
|
|
80
|
+
get a friendly error pointing at the format spec. Allows
|
|
81
|
+
`Merge`/`Revert`/`fixup!`/`squash!` for ergonomics.
|
|
82
|
+
- `pre-push`: full `pnpm test`. Stops broken builds from reaching
|
|
83
|
+
the remote.
|
|
84
|
+
- Bypass for emergencies: `LEFTHOOK=0 git commit` or
|
|
85
|
+
`LEFTHOOK_EXCLUDE=<jobname> git commit`. Installed automatically by
|
|
86
|
+
`pnpm install`; no manual `lefthook install` required.
|
|
87
|
+
- Prettier configured (added 2026-05-20): `.prettierrc.json` + scripts
|
|
88
|
+
`pnpm format` / `pnpm format:check`. Single quotes, trailing commas,
|
|
89
|
+
100-col print width, LF endings. Normalized 31 files in one mechanical
|
|
90
|
+
pass; wired into `pnpm check` and the lefthook pre-commit so future
|
|
91
|
+
drift gets blocked.
|
|
92
|
+
- Hand-rolled input validation for every MCP tool (no deps). Rejects unknown
|
|
93
|
+
fields, type errors, out-of-range numbers, oversize strings.
|
|
94
|
+
- Interaction log (`~/.graphpilot/<repo-id>/interactions.jsonl`): every tool
|
|
95
|
+
call recorded locally with sanitized inputs. Enables future ranking /
|
|
96
|
+
personalization. Disabled via `GRAPHPILOT_NO_LOG=1`. Mode 0600.
|
|
97
|
+
|
|
98
|
+
### Security
|
|
99
|
+
|
|
100
|
+
- 5 MB per-file size cap (`MAX_FILE_BYTES`)
|
|
101
|
+
- Iterative `walk()` (no stack overflow on deep ASTs)
|
|
102
|
+
- Symlink-escape protection: `followSymbolicLinks: false` + realpath bounds check
|
|
103
|
+
- 50,000 file hard cap per index (`MAX_FILES_PER_INDEX`)
|
|
104
|
+
- Refuses to index `/`, `/etc`, `~`, `/Users`, Windows system paths, and macOS
|
|
105
|
+
resolved aliases (`/private/etc`, etc.)
|
|
106
|
+
- Graph dir/file written with mode `0o700` / `0o600`
|
|
107
|
+
- Pattern-based secret redaction at signature-extraction time
|
|
108
|
+
(`src/redact.ts`): OpenAI/Anthropic `sk-`, GitHub `ghp_`/`ghs_`, AWS
|
|
109
|
+
`AKIA`, JWTs, PEM private-key headers, Slack tokens, Stripe live keys,
|
|
110
|
+
plus a defensive long-token catch-all.
|
|
111
|
+
- Schema validation on graph.json load (`src/graph-schema.ts`): strict
|
|
112
|
+
shape check, version enforcement, per-entry sanitization (control chars
|
|
113
|
+
stripped, length-capped), and recomputed counts (attacker-supplied
|
|
114
|
+
symbol/edge counts are ignored). Defends against tampered or corrupt
|
|
115
|
+
files; falls back to "no index" on rejection.
|
|
116
|
+
- ESLint policy enforcing "no network in `src/`" at the build gate
|
|
117
|
+
(`eslint.config.js`): bans `http`, `https`, `undici`, `axios`,
|
|
118
|
+
`node-fetch`, `cross-fetch`, `got`, `request`, `superagent`, plus
|
|
119
|
+
`child_process`. Looser rules for `tests/` and `scripts/`. CI runs
|
|
120
|
+
`pnpm lint` as a gating job; meta-tests in `tests/lint-policy.test.ts`
|
|
121
|
+
prove the rule fires on every banned import (catches rule-rot in
|
|
122
|
+
future PRs).
|
|
123
|
+
|
|
124
|
+
### Pending (for v0.1.0 launch)
|
|
125
|
+
|
|
126
|
+
- Tier-B agent benchmark — Claude-Code-in-the-loop scoring on real
|
|
127
|
+
refactor tasks; produces the "X/10 vs Y/10" headline. Spec in
|
|
128
|
+
[`bench/run-agent-tier.md`](bench/run-agent-tier.md).
|
|
129
|
+
- `release.yml` workflow + npm publish on tag.
|
|
130
|
+
- CodeQL + dependency-review workflows.
|
|
131
|
+
- Branch protection on `main` (GitHub web UI step).
|
|
132
|
+
- Hero GIF + 30-second demo video.
|
|
133
|
+
- Domain + landing page.
|
|
134
|
+
- MCP registry submissions (Glama, PulseMCP, mcpservers.org,
|
|
135
|
+
`awesome-mcp-servers`).
|
|
136
|
+
- `examples/<each-client>/` scaffolds.
|
|
137
|
+
|
|
138
|
+
[Unreleased]: https://github.com/graphpilot-oss/graphpilot/commits/main
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
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.
|
|
6
|
+
|
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
|
8
|
+
|
|
9
|
+
## Our Standards
|
|
10
|
+
|
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
|
12
|
+
|
|
13
|
+
- Demonstrating empathy and kindness toward other people
|
|
14
|
+
- Being respectful of differing opinions, viewpoints, and experiences
|
|
15
|
+
- Giving and gracefully accepting constructive feedback
|
|
16
|
+
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
|
17
|
+
- Focusing on what is best not just for us as individuals, but for the overall community
|
|
18
|
+
|
|
19
|
+
Examples of unacceptable behavior include:
|
|
20
|
+
|
|
21
|
+
- The use of sexualized language or imagery, and sexual attention or advances of any kind
|
|
22
|
+
- Trolling, insulting or derogatory comments, and personal or political attacks
|
|
23
|
+
- Public or private harassment
|
|
24
|
+
- Publishing others' private information, such as a physical or email address, without their explicit permission
|
|
25
|
+
- Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
26
|
+
|
|
27
|
+
## Enforcement Responsibilities
|
|
28
|
+
|
|
29
|
+
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.
|
|
30
|
+
|
|
31
|
+
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.
|
|
32
|
+
|
|
33
|
+
## Scope
|
|
34
|
+
|
|
35
|
+
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 e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
|
36
|
+
|
|
37
|
+
## Enforcement
|
|
38
|
+
|
|
39
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at codewithakki@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
|
|
40
|
+
|
|
41
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
|
42
|
+
|
|
43
|
+
## Enforcement Guidelines
|
|
44
|
+
|
|
45
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
|
46
|
+
|
|
47
|
+
### 1. Correction
|
|
48
|
+
|
|
49
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
|
50
|
+
|
|
51
|
+
**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.
|
|
52
|
+
|
|
53
|
+
### 2. Warning
|
|
54
|
+
|
|
55
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
|
56
|
+
|
|
57
|
+
**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 of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
|
58
|
+
|
|
59
|
+
### 3. Temporary Ban
|
|
60
|
+
|
|
61
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
|
62
|
+
|
|
63
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. 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.
|
|
64
|
+
|
|
65
|
+
### 4. Permanent Ban
|
|
66
|
+
|
|
67
|
+
**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.
|
|
68
|
+
|
|
69
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
|
70
|
+
|
|
71
|
+
## Attribution
|
|
72
|
+
|
|
73
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
74
|
+
|
|
75
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
|
76
|
+
|
|
77
|
+
For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations].
|
|
78
|
+
|
|
79
|
+
[homepage]: https://www.contributor-covenant.org
|
|
80
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
81
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
82
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
|
83
|
+
[translations]: https://www.contributor-covenant.org/translations
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Contributing to GraphPilot
|
|
2
|
+
|
|
3
|
+
Thanks for your interest! GraphPilot is young — every contribution helps shape it.
|
|
4
|
+
|
|
5
|
+
## Before you start
|
|
6
|
+
|
|
7
|
+
- For non-trivial changes, **open an issue first** so we can discuss the approach before
|
|
8
|
+
you spend time writing code.
|
|
9
|
+
- Look for the [`good first issue`](../../labels/good%20first%20issue) label.
|
|
10
|
+
- Read the [README](README.md) to understand the project shape.
|
|
11
|
+
|
|
12
|
+
## Development setup
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
git clone https://github.com/graphpilot-oss/graphpilot.git
|
|
16
|
+
cd graphpilot
|
|
17
|
+
pnpm install
|
|
18
|
+
pnpm build
|
|
19
|
+
pnpm test
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
You need Node.js 20+ and pnpm 9+.
|
|
23
|
+
|
|
24
|
+
## Running locally against Claude Code
|
|
25
|
+
|
|
26
|
+
Once the MCP server is in (it's not yet, as of this writing), point Claude Code at
|
|
27
|
+
your local build by adding to `~/.claude.json`:
|
|
28
|
+
|
|
29
|
+
```jsonc
|
|
30
|
+
{
|
|
31
|
+
"mcpServers": {
|
|
32
|
+
"graphpilot-dev": {
|
|
33
|
+
"command": "node",
|
|
34
|
+
"args": ["/absolute/path/to/graphpilot/dist/cli.js", "mcp"],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Restart Claude Code.
|
|
41
|
+
|
|
42
|
+
## Commit style
|
|
43
|
+
|
|
44
|
+
We use [Conventional Commits](https://www.conventionalcommits.org):
|
|
45
|
+
|
|
46
|
+
- `feat: add gp_callers tool`
|
|
47
|
+
- `fix: handle empty TS files gracefully`
|
|
48
|
+
- `docs: clarify mcp setup for Cursor`
|
|
49
|
+
- `test: add fixture for re-exports`
|
|
50
|
+
- `chore: bump deps`
|
|
51
|
+
- `refactor: simplify symbol id format`
|
|
52
|
+
|
|
53
|
+
One topic per commit. Commit messages explain the _why_, not just the _what_.
|
|
54
|
+
|
|
55
|
+
## Pull requests
|
|
56
|
+
|
|
57
|
+
1. Fork the repo.
|
|
58
|
+
2. Create a branch: `git checkout -b feat/your-feature`.
|
|
59
|
+
3. Make your changes; add tests for any new behavior.
|
|
60
|
+
4. Run `pnpm test` and `pnpm build` — both must pass.
|
|
61
|
+
5. Update [CHANGELOG.md](CHANGELOG.md) under the `[Unreleased]` section.
|
|
62
|
+
6. Open a PR with a clear description (what + why; link the issue).
|
|
63
|
+
7. CI must pass. At least one maintainer review is required before merge.
|
|
64
|
+
|
|
65
|
+
## Code style
|
|
66
|
+
|
|
67
|
+
- TypeScript strict mode, no `any` unless commented why.
|
|
68
|
+
- 2-space indent, single quotes, trailing commas where valid (matches `.editorconfig`).
|
|
69
|
+
- One thing per file. If a file passes ~300 lines, consider splitting it.
|
|
70
|
+
- Tests next to code in `tests/`. Fixtures in `tests/fixtures/`.
|
|
71
|
+
|
|
72
|
+
## Security
|
|
73
|
+
|
|
74
|
+
GraphPilot reads code from people's repos and exposes a memory layer to AI agents.
|
|
75
|
+
That means it's an attractive target for both supply-chain attacks and prompt-injection
|
|
76
|
+
via crafted code. Before you contribute:
|
|
77
|
+
|
|
78
|
+
- **Read [SECURITY.md](SECURITY.md)** for how to report vulnerabilities privately.
|
|
79
|
+
- **No network code in `src/`.** Local-first is a user promise. If a feature seems to
|
|
80
|
+
need the network, open a Discussion first.
|
|
81
|
+
- **No `child_process` / `exec` / `spawn`.** We don't shell out, ever.
|
|
82
|
+
- **Validate every input that crosses a trust boundary.** Files on disk, CLI args, and
|
|
83
|
+
(when the MCP server lands) tool arguments are all untrusted by default.
|
|
84
|
+
- **No telemetry, analytics, or "anonymous usage stats."** Not by default, not behind
|
|
85
|
+
a flag, not at all in v1.
|
|
86
|
+
|
|
87
|
+
PRs that introduce network calls, child processes, eval, dynamic require, or unvalidated
|
|
88
|
+
file-path arguments will be rejected unless there's a written threat-model justification
|
|
89
|
+
in the PR description.
|
|
90
|
+
|
|
91
|
+
## What we are NOT doing in v1
|
|
92
|
+
|
|
93
|
+
Please don't open PRs that add:
|
|
94
|
+
|
|
95
|
+
- Cross-repo indexing
|
|
96
|
+
- A query DSL
|
|
97
|
+
- A web visualization
|
|
98
|
+
- Watch mode (manual re-index is fine for v1)
|
|
99
|
+
- Stack Graphs / production-grade name resolution
|
|
100
|
+
- Languages other than TS/JS
|
|
101
|
+
|
|
102
|
+
These are explicitly deferred. Keeping v1 small is the only way it ships.
|
|
103
|
+
|
|
104
|
+
## Code of Conduct
|
|
105
|
+
|
|
106
|
+
By participating you agree to [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md).
|
|
107
|
+
|
|
108
|
+
## Questions
|
|
109
|
+
|
|
110
|
+
Open a [Discussion](../../discussions) for general questions; open an
|
|
111
|
+
[Issue](../../issues) for bugs.
|