code2graph-rs 0.0.0b3__tar.gz
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.
- code2graph_rs-0.0.0b3/.github/workflows/ci.yml +23 -0
- code2graph_rs-0.0.0b3/.github/workflows/release.yml +300 -0
- code2graph_rs-0.0.0b3/.github/workflows/test.yml +84 -0
- code2graph_rs-0.0.0b3/.gitignore +107 -0
- code2graph_rs-0.0.0b3/CODE_OF_CONDUCT.md +83 -0
- code2graph_rs-0.0.0b3/CONTRIBUTING.md +264 -0
- code2graph_rs-0.0.0b3/Cargo.lock +865 -0
- code2graph_rs-0.0.0b3/Cargo.toml +87 -0
- code2graph_rs-0.0.0b3/LICENSE +201 -0
- code2graph_rs-0.0.0b3/PKG-INFO +53 -0
- code2graph_rs-0.0.0b3/README.md +178 -0
- code2graph_rs-0.0.0b3/assets/discord-cta.svg +36 -0
- code2graph_rs-0.0.0b3/bindings/python/.gitignore +6 -0
- code2graph_rs-0.0.0b3/bindings/python/Cargo.toml +17 -0
- code2graph_rs-0.0.0b3/bindings/python/README.md +42 -0
- code2graph_rs-0.0.0b3/bindings/python/src/lib.rs +69 -0
- code2graph_rs-0.0.0b3/docs/ffi-support-matrix.md +110 -0
- code2graph_rs-0.0.0b3/docs/supported-languages.md +135 -0
- code2graph_rs-0.0.0b3/pyproject.toml +19 -0
- code2graph_rs-0.0.0b3/src/error.rs +33 -0
- code2graph_rs-0.0.0b3/src/extract/c.rs +1408 -0
- code2graph_rs-0.0.0b3/src/extract/cpp.rs +1905 -0
- code2graph_rs-0.0.0b3/src/extract/csharp.rs +1441 -0
- code2graph_rs-0.0.0b3/src/extract/dart.rs +1434 -0
- code2graph_rs-0.0.0b3/src/extract/dispatch.rs +134 -0
- code2graph_rs-0.0.0b3/src/extract/go.rs +1746 -0
- code2graph_rs-0.0.0b3/src/extract/hcl.rs +830 -0
- code2graph_rs-0.0.0b3/src/extract/java.rs +2164 -0
- code2graph_rs-0.0.0b3/src/extract/javascript.rs +103 -0
- code2graph_rs-0.0.0b3/src/extract/kotlin.rs +2083 -0
- code2graph_rs-0.0.0b3/src/extract/lua.rs +943 -0
- code2graph_rs-0.0.0b3/src/extract/luau.rs +138 -0
- code2graph_rs-0.0.0b3/src/extract/mod.rs +120 -0
- code2graph_rs-0.0.0b3/src/extract/pascal.rs +1485 -0
- code2graph_rs-0.0.0b3/src/extract/php.rs +1706 -0
- code2graph_rs-0.0.0b3/src/extract/python.rs +1685 -0
- code2graph_rs-0.0.0b3/src/extract/ruby.rs +1060 -0
- code2graph_rs-0.0.0b3/src/extract/rust.rs +2932 -0
- code2graph_rs-0.0.0b3/src/extract/scala.rs +1340 -0
- code2graph_rs-0.0.0b3/src/extract/shell.rs +624 -0
- code2graph_rs-0.0.0b3/src/extract/solidity.rs +2101 -0
- code2graph_rs-0.0.0b3/src/extract/sql.rs +876 -0
- code2graph_rs-0.0.0b3/src/extract/support.rs +607 -0
- code2graph_rs-0.0.0b3/src/extract/svelte.rs +462 -0
- code2graph_rs-0.0.0b3/src/extract/swift.rs +2048 -0
- code2graph_rs-0.0.0b3/src/extract/typescript.rs +1321 -0
- code2graph_rs-0.0.0b3/src/ffi/c.rs +12 -0
- code2graph_rs-0.0.0b3/src/ffi/jni.rs +13 -0
- code2graph_rs-0.0.0b3/src/ffi/mod.rs +16 -0
- code2graph_rs-0.0.0b3/src/ffi/node_api.rs +12 -0
- code2graph_rs-0.0.0b3/src/ffi/python.rs +12 -0
- code2graph_rs-0.0.0b3/src/ffi/spec.rs +93 -0
- code2graph_rs-0.0.0b3/src/ffi/sync_tests.rs +31 -0
- code2graph_rs-0.0.0b3/src/ffi/wasm.rs +12 -0
- code2graph_rs-0.0.0b3/src/grammar.rs +210 -0
- code2graph_rs-0.0.0b3/src/graph/mod.rs +11 -0
- code2graph_rs-0.0.0b3/src/graph/types.rs +670 -0
- code2graph_rs-0.0.0b3/src/lang.rs +214 -0
- code2graph_rs-0.0.0b3/src/lib.rs +75 -0
- code2graph_rs-0.0.0b3/src/package/enrich.rs +234 -0
- code2graph_rs-0.0.0b3/src/package/manifest.rs +181 -0
- code2graph_rs-0.0.0b3/src/package/mod.rs +17 -0
- code2graph_rs-0.0.0b3/src/resolve/conformance.rs +555 -0
- code2graph_rs-0.0.0b3/src/resolve/external.rs +466 -0
- code2graph_rs-0.0.0b3/src/resolve/ffi_bridge/mod.rs +36 -0
- code2graph_rs-0.0.0b3/src/resolve/ffi_bridge/resolver.rs +413 -0
- code2graph_rs-0.0.0b3/src/resolve/incremental/mod.rs +23 -0
- code2graph_rs-0.0.0b3/src/resolve/incremental/stitch.rs +407 -0
- code2graph_rs-0.0.0b3/src/resolve/incremental/store.rs +409 -0
- code2graph_rs-0.0.0b3/src/resolve/incremental/subgraph.rs +472 -0
- code2graph_rs-0.0.0b3/src/resolve/layered.rs +479 -0
- code2graph_rs-0.0.0b3/src/resolve/mod.rs +39 -0
- code2graph_rs-0.0.0b3/src/resolve/normalized_name.rs +284 -0
- code2graph_rs-0.0.0b3/src/resolve/resolver.rs +11 -0
- code2graph_rs-0.0.0b3/src/resolve/scope_graph.rs +1065 -0
- code2graph_rs-0.0.0b3/src/resolve/support.rs +167 -0
- code2graph_rs-0.0.0b3/src/resolve/symbol_table.rs +884 -0
- code2graph_rs-0.0.0b3/src/symbol/descriptor.rs +286 -0
- code2graph_rs-0.0.0b3/src/symbol/id.rs +617 -0
- code2graph_rs-0.0.0b3/src/symbol/mod.rs +11 -0
- code2graph_rs-0.0.0b3/src/symbol/serde_impl.rs +24 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
# PR gate: runs the reusable test suite on every non-draft PR to main.
|
|
4
|
+
on:
|
|
5
|
+
pull_request:
|
|
6
|
+
branches: [main]
|
|
7
|
+
types: [opened, synchronize, reopened, ready_for_review]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
# Cancel superseded runs on the same ref to save CI minutes.
|
|
11
|
+
concurrency:
|
|
12
|
+
group: ci-${{ github.ref }}
|
|
13
|
+
cancel-in-progress: true
|
|
14
|
+
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
test:
|
|
20
|
+
name: Test
|
|
21
|
+
# Skip draft PRs, but always run on manual dispatch.
|
|
22
|
+
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
|
|
23
|
+
uses: ./.github/workflows/test.yml
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
# Tag-driven release. Push a tag `vX.Y.Z` (or a prerelease `vX.Y.Z-beta.N`) whose
|
|
4
|
+
# base version matches `[workspace.package] version` in Cargo.toml. One synced
|
|
5
|
+
# version drives crates.io (code2graph), PyPI (code2graph-rs) and npm (code2graph-rs).
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
tags: ["v*"]
|
|
9
|
+
|
|
10
|
+
concurrency:
|
|
11
|
+
group: release
|
|
12
|
+
cancel-in-progress: false
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
|
|
17
|
+
env:
|
|
18
|
+
CARGO_TERM_COLOR: always
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
validate-version:
|
|
22
|
+
name: Validate version tag
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
outputs:
|
|
25
|
+
version: ${{ steps.version.outputs.version }}
|
|
26
|
+
is_prerelease: ${{ steps.version.outputs.is_prerelease }}
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v6
|
|
29
|
+
- name: Install Rust
|
|
30
|
+
uses: dtolnay/rust-toolchain@stable
|
|
31
|
+
- name: Validate tag against workspace version
|
|
32
|
+
id: version
|
|
33
|
+
run: |
|
|
34
|
+
TAG="${GITHUB_REF_NAME}"
|
|
35
|
+
TAG_VERSION="${TAG#v}"
|
|
36
|
+
CARGO_VERSION=$(cargo metadata --no-deps --format-version=1 \
|
|
37
|
+
| jq -r '.packages[] | select(.name == "code2graph") | .version')
|
|
38
|
+
|
|
39
|
+
if [[ ! "$TAG_VERSION" =~ ^([0-9]+\.[0-9]+\.[0-9]+)(-[a-zA-Z]+\.[0-9]+)?$ ]]; then
|
|
40
|
+
echo "::error::Invalid tag '$TAG'. Expected vX.Y.Z or vX.Y.Z-label.N"
|
|
41
|
+
exit 1
|
|
42
|
+
fi
|
|
43
|
+
TAG_BASE="${BASH_REMATCH[1]}"
|
|
44
|
+
CARGO_BASE=$(echo "$CARGO_VERSION" | grep -oP '^\d+\.\d+\.\d+')
|
|
45
|
+
if [[ "$TAG_BASE" != "$CARGO_BASE" ]]; then
|
|
46
|
+
echo "::error::Tag base '$TAG_BASE' != Cargo.toml version '$CARGO_BASE'"
|
|
47
|
+
exit 1
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
if [[ "$TAG_VERSION" == *-* ]]; then
|
|
51
|
+
echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
|
|
52
|
+
else
|
|
53
|
+
echo "is_prerelease=false" >> "$GITHUB_OUTPUT"
|
|
54
|
+
fi
|
|
55
|
+
echo "version=$TAG_VERSION" >> "$GITHUB_OUTPUT"
|
|
56
|
+
echo "Releasing $TAG_VERSION"
|
|
57
|
+
|
|
58
|
+
ci:
|
|
59
|
+
name: Test
|
|
60
|
+
needs: validate-version
|
|
61
|
+
uses: ./.github/workflows/test.yml
|
|
62
|
+
|
|
63
|
+
publish-crates:
|
|
64
|
+
name: Publish to crates.io
|
|
65
|
+
needs: [validate-version, ci]
|
|
66
|
+
runs-on: ubuntu-latest
|
|
67
|
+
environment: crates.io
|
|
68
|
+
steps:
|
|
69
|
+
- uses: actions/checkout@v6
|
|
70
|
+
- name: Install Rust
|
|
71
|
+
uses: dtolnay/rust-toolchain@stable
|
|
72
|
+
- name: Stamp version
|
|
73
|
+
run: |
|
|
74
|
+
VERSION="${{ needs.validate-version.outputs.version }}"
|
|
75
|
+
sed -i "0,/^version = \".*\"/s//version = \"$VERSION\"/" Cargo.toml
|
|
76
|
+
- name: Publish code2graph
|
|
77
|
+
env:
|
|
78
|
+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
|
79
|
+
run: |
|
|
80
|
+
VERSION="${{ needs.validate-version.outputs.version }}"
|
|
81
|
+
if curl -sf -H "User-Agent: code2graph-ci (github.com/nodedb-lab/code2graph)" \
|
|
82
|
+
"https://crates.io/api/v1/crates/code2graph/$VERSION" > /dev/null 2>&1; then
|
|
83
|
+
echo "code2graph@$VERSION already published — skipping"
|
|
84
|
+
else
|
|
85
|
+
cargo publish -p code2graph --allow-dirty --no-verify
|
|
86
|
+
fi
|
|
87
|
+
|
|
88
|
+
build-sdist:
|
|
89
|
+
name: Build sdist
|
|
90
|
+
needs: validate-version
|
|
91
|
+
runs-on: ubuntu-latest
|
|
92
|
+
steps:
|
|
93
|
+
- uses: actions/checkout@v6
|
|
94
|
+
- name: Stamp version
|
|
95
|
+
run: |
|
|
96
|
+
VERSION="${{ needs.validate-version.outputs.version }}"
|
|
97
|
+
PYPI_VERSION=$(echo "$VERSION" | sed -E 's/-alpha\./a/; s/-beta\./b/; s/-rc\./rc/')
|
|
98
|
+
sed -i "0,/^version = \".*\"/s//version = \"$VERSION\"/" Cargo.toml
|
|
99
|
+
sed -i "s/^version = .*/version = \"$PYPI_VERSION\"/" bindings/python/pyproject.toml
|
|
100
|
+
- name: Build sdist
|
|
101
|
+
uses: PyO3/maturin-action@v1
|
|
102
|
+
with:
|
|
103
|
+
command: sdist
|
|
104
|
+
args: --out dist -m bindings/python/Cargo.toml
|
|
105
|
+
- uses: actions/upload-artifact@v7
|
|
106
|
+
with:
|
|
107
|
+
name: wheels-sdist
|
|
108
|
+
path: dist
|
|
109
|
+
|
|
110
|
+
build-wheels:
|
|
111
|
+
name: Build wheel (${{ matrix.target }})
|
|
112
|
+
needs: validate-version
|
|
113
|
+
runs-on: ${{ matrix.os }}
|
|
114
|
+
strategy:
|
|
115
|
+
fail-fast: false
|
|
116
|
+
matrix:
|
|
117
|
+
include:
|
|
118
|
+
- os: ubuntu-latest
|
|
119
|
+
target: x86_64-unknown-linux-gnu
|
|
120
|
+
manylinux: auto
|
|
121
|
+
- os: ubuntu-latest
|
|
122
|
+
target: aarch64-unknown-linux-gnu
|
|
123
|
+
manylinux: auto
|
|
124
|
+
- os: ubuntu-latest
|
|
125
|
+
target: x86_64-unknown-linux-musl
|
|
126
|
+
manylinux: musllinux_1_2
|
|
127
|
+
# Intel macOS hosted runners (macos-13) are retired; cross-compile the
|
|
128
|
+
# x86_64 wheel on an Apple Silicon runner (the target is set above).
|
|
129
|
+
- os: macos-latest
|
|
130
|
+
target: x86_64-apple-darwin
|
|
131
|
+
- os: macos-latest
|
|
132
|
+
target: aarch64-apple-darwin
|
|
133
|
+
- os: windows-latest
|
|
134
|
+
target: x86_64-pc-windows-msvc
|
|
135
|
+
steps:
|
|
136
|
+
- uses: actions/checkout@v6
|
|
137
|
+
- name: Stamp version
|
|
138
|
+
shell: bash
|
|
139
|
+
run: |
|
|
140
|
+
VERSION="${{ needs.validate-version.outputs.version }}"
|
|
141
|
+
PYPI_VERSION=$(echo "$VERSION" | sed -E 's/-alpha\./a/; s/-beta\./b/; s/-rc\./rc/')
|
|
142
|
+
sed -i.bak "0,/^version = \".*\"/s//version = \"$VERSION\"/" Cargo.toml && rm -f Cargo.toml.bak
|
|
143
|
+
sed -i.bak "s/^version = .*/version = \"$PYPI_VERSION\"/" bindings/python/pyproject.toml && rm -f bindings/python/pyproject.toml.bak
|
|
144
|
+
- name: Build wheel
|
|
145
|
+
uses: PyO3/maturin-action@v1
|
|
146
|
+
with:
|
|
147
|
+
target: ${{ matrix.target }}
|
|
148
|
+
manylinux: ${{ matrix.manylinux || 'auto' }}
|
|
149
|
+
args: --release --out dist -m bindings/python/Cargo.toml
|
|
150
|
+
sccache: "true"
|
|
151
|
+
# tree-sitter grammars' generated parser.c uses C99 for-loop init and
|
|
152
|
+
# some scanners use C11 static_assert; the manylinux cross-GCC defaults
|
|
153
|
+
# to C89. Force C11 inside the build container (linux/docker only).
|
|
154
|
+
docker-options: ${{ contains(matrix.target, 'linux') && '-e CFLAGS=-std=gnu11' || '' }}
|
|
155
|
+
- uses: actions/upload-artifact@v7
|
|
156
|
+
with:
|
|
157
|
+
name: wheels-${{ matrix.target }}
|
|
158
|
+
path: dist
|
|
159
|
+
|
|
160
|
+
publish-pypi:
|
|
161
|
+
name: Publish to PyPI
|
|
162
|
+
needs: [validate-version, build-wheels, build-sdist]
|
|
163
|
+
runs-on: ubuntu-latest
|
|
164
|
+
environment: pypi
|
|
165
|
+
permissions:
|
|
166
|
+
id-token: write
|
|
167
|
+
steps:
|
|
168
|
+
- uses: actions/download-artifact@v8
|
|
169
|
+
with:
|
|
170
|
+
pattern: wheels-*
|
|
171
|
+
path: dist
|
|
172
|
+
merge-multiple: true
|
|
173
|
+
- name: Publish (Trusted Publishing / OIDC)
|
|
174
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
175
|
+
with:
|
|
176
|
+
skip-existing: true
|
|
177
|
+
|
|
178
|
+
build-node:
|
|
179
|
+
name: Build addon (${{ matrix.target }})
|
|
180
|
+
needs: validate-version
|
|
181
|
+
runs-on: ${{ matrix.runner }}
|
|
182
|
+
strategy:
|
|
183
|
+
fail-fast: false
|
|
184
|
+
matrix:
|
|
185
|
+
include:
|
|
186
|
+
- target: x86_64-unknown-linux-gnu
|
|
187
|
+
runner: ubuntu-latest
|
|
188
|
+
- target: aarch64-unknown-linux-gnu
|
|
189
|
+
runner: ubuntu-latest
|
|
190
|
+
napi_cross: true
|
|
191
|
+
- target: x86_64-unknown-linux-musl
|
|
192
|
+
runner: ubuntu-latest
|
|
193
|
+
zig: true
|
|
194
|
+
# Intel macOS runners are retired; cross-compile x86_64 on Apple Silicon.
|
|
195
|
+
- target: x86_64-apple-darwin
|
|
196
|
+
runner: macos-latest
|
|
197
|
+
- target: aarch64-apple-darwin
|
|
198
|
+
runner: macos-latest
|
|
199
|
+
- target: x86_64-pc-windows-msvc
|
|
200
|
+
runner: windows-latest
|
|
201
|
+
steps:
|
|
202
|
+
- uses: actions/checkout@v6
|
|
203
|
+
- uses: actions/setup-node@v5
|
|
204
|
+
with:
|
|
205
|
+
node-version: "22"
|
|
206
|
+
- name: Install Rust
|
|
207
|
+
uses: dtolnay/rust-toolchain@stable
|
|
208
|
+
with:
|
|
209
|
+
targets: ${{ matrix.target }}
|
|
210
|
+
- uses: Swatinem/rust-cache@v2
|
|
211
|
+
with:
|
|
212
|
+
prefix-key: node-${{ matrix.target }}
|
|
213
|
+
- name: Install zig (musl cross-compile)
|
|
214
|
+
if: matrix.zig
|
|
215
|
+
run: |
|
|
216
|
+
pip install ziglang
|
|
217
|
+
cargo install --locked cargo-zigbuild
|
|
218
|
+
- name: Install napi cross-toolchain (linux aarch64)
|
|
219
|
+
if: matrix.napi_cross
|
|
220
|
+
run: npm install -g @napi-rs/cross-toolchain
|
|
221
|
+
- name: Install deps
|
|
222
|
+
working-directory: bindings/node
|
|
223
|
+
run: npm ci
|
|
224
|
+
- name: Build addon
|
|
225
|
+
working-directory: bindings/node
|
|
226
|
+
# tree-sitter grammars need C11 (for-loop init / static_assert); the napi
|
|
227
|
+
# aarch64 cross-GCC defaults to C89. Harmless on the modern gnu/clang/zig
|
|
228
|
+
# targets; omitted on Windows, whose MSVC rejects -std=gnu11.
|
|
229
|
+
env:
|
|
230
|
+
CFLAGS: ${{ !contains(matrix.target, 'windows') && '-std=gnu11' || '' }}
|
|
231
|
+
run: npx napi build --platform --release --target ${{ matrix.target }} ${{ matrix.zig && '-x' || '' }} ${{ matrix.napi_cross && '--use-napi-cross' || '' }}
|
|
232
|
+
- uses: actions/upload-artifact@v7
|
|
233
|
+
with:
|
|
234
|
+
name: node-${{ matrix.target }}
|
|
235
|
+
path: bindings/node/*.node
|
|
236
|
+
|
|
237
|
+
publish-npm:
|
|
238
|
+
name: Publish to npm
|
|
239
|
+
needs: [validate-version, build-node, publish-crates]
|
|
240
|
+
runs-on: ubuntu-latest
|
|
241
|
+
environment: npm
|
|
242
|
+
permissions:
|
|
243
|
+
contents: read
|
|
244
|
+
id-token: write
|
|
245
|
+
steps:
|
|
246
|
+
- uses: actions/checkout@v6
|
|
247
|
+
- uses: actions/setup-node@v5
|
|
248
|
+
with:
|
|
249
|
+
node-version: "22"
|
|
250
|
+
registry-url: "https://registry.npmjs.org"
|
|
251
|
+
- name: Install deps
|
|
252
|
+
working-directory: bindings/node
|
|
253
|
+
run: npm ci
|
|
254
|
+
- name: Download addon artifacts
|
|
255
|
+
uses: actions/download-artifact@v8
|
|
256
|
+
with:
|
|
257
|
+
path: bindings/node/artifacts
|
|
258
|
+
pattern: node-*
|
|
259
|
+
merge-multiple: true
|
|
260
|
+
- name: Stamp version
|
|
261
|
+
working-directory: bindings/node
|
|
262
|
+
run: |
|
|
263
|
+
VERSION="${{ needs.validate-version.outputs.version }}"
|
|
264
|
+
jq --arg v "$VERSION" '.version = $v' package.json > tmp.json && mv tmp.json package.json
|
|
265
|
+
- name: Assemble platform packages
|
|
266
|
+
working-directory: bindings/node
|
|
267
|
+
run: |
|
|
268
|
+
npx napi create-npm-dirs --npm-dir ./npm
|
|
269
|
+
npx napi artifacts --output-dir ./artifacts --npm-dir ./npm
|
|
270
|
+
npx napi prepublish -t npm --npm-dir ./npm --skip-optional-publish
|
|
271
|
+
- name: Publish (idempotent, with provenance)
|
|
272
|
+
working-directory: bindings/node
|
|
273
|
+
env:
|
|
274
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
275
|
+
NPM_CONFIG_PROVENANCE: "true"
|
|
276
|
+
run: |
|
|
277
|
+
publish_pkg() {
|
|
278
|
+
local dir="$1" name ver
|
|
279
|
+
name=$(jq -r .name "$dir/package.json")
|
|
280
|
+
ver=$(jq -r .version "$dir/package.json")
|
|
281
|
+
if npm view "$name@$ver" version >/dev/null 2>&1; then
|
|
282
|
+
echo "$name@$ver already published — skipping"
|
|
283
|
+
else
|
|
284
|
+
npm publish "$dir" --access public
|
|
285
|
+
fi
|
|
286
|
+
}
|
|
287
|
+
for dir in npm/*/; do publish_pkg "$dir"; done
|
|
288
|
+
publish_pkg .
|
|
289
|
+
|
|
290
|
+
github-release:
|
|
291
|
+
name: GitHub release
|
|
292
|
+
needs: [validate-version, publish-crates, publish-pypi, publish-npm]
|
|
293
|
+
runs-on: ubuntu-latest
|
|
294
|
+
permissions:
|
|
295
|
+
contents: write
|
|
296
|
+
steps:
|
|
297
|
+
- uses: softprops/action-gh-release@v2
|
|
298
|
+
with:
|
|
299
|
+
generate_release_notes: true
|
|
300
|
+
prerelease: ${{ needs.validate-version.outputs.is_prerelease == 'true' }}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
# Reusable test suite. Called by ci.yml (PR gate) and release.yml (pre-publish gate)
|
|
4
|
+
# so both run the exact same checks.
|
|
5
|
+
on:
|
|
6
|
+
workflow_call:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
env:
|
|
12
|
+
CARGO_TERM_COLOR: always
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
lint:
|
|
16
|
+
name: Lint, format & docs
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v6
|
|
20
|
+
- name: Install Rust
|
|
21
|
+
uses: dtolnay/rust-toolchain@stable
|
|
22
|
+
with:
|
|
23
|
+
components: rustfmt, clippy
|
|
24
|
+
- uses: Swatinem/rust-cache@v2
|
|
25
|
+
with:
|
|
26
|
+
prefix-key: lint
|
|
27
|
+
- name: Check formatting
|
|
28
|
+
run: cargo fmt --all --check
|
|
29
|
+
- name: Clippy
|
|
30
|
+
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
|
|
31
|
+
- name: Build docs
|
|
32
|
+
env:
|
|
33
|
+
RUSTDOCFLAGS: -D warnings
|
|
34
|
+
run: cargo doc --no-deps --all-features
|
|
35
|
+
- name: Doctests
|
|
36
|
+
run: cargo test --doc --all-features
|
|
37
|
+
|
|
38
|
+
test:
|
|
39
|
+
name: Test (${{ matrix.os }})
|
|
40
|
+
runs-on: ${{ matrix.os }}
|
|
41
|
+
strategy:
|
|
42
|
+
fail-fast: false
|
|
43
|
+
matrix:
|
|
44
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
45
|
+
steps:
|
|
46
|
+
- uses: actions/checkout@v6
|
|
47
|
+
- name: Install Rust
|
|
48
|
+
uses: dtolnay/rust-toolchain@stable
|
|
49
|
+
- uses: Swatinem/rust-cache@v2
|
|
50
|
+
with:
|
|
51
|
+
prefix-key: test
|
|
52
|
+
# The pyo3/napi cdylib crates are extension modules that cannot be linked
|
|
53
|
+
# as cargo test binaries; they are built via maturin/napi in the `bindings`
|
|
54
|
+
# job below. Everything else is tested across all three OSes.
|
|
55
|
+
- name: Run tests
|
|
56
|
+
run: cargo test --workspace --all-features --exclude code2graph-py --exclude code2graph-node
|
|
57
|
+
|
|
58
|
+
bindings:
|
|
59
|
+
name: Build bindings
|
|
60
|
+
runs-on: ubuntu-latest
|
|
61
|
+
steps:
|
|
62
|
+
- uses: actions/checkout@v6
|
|
63
|
+
- name: Install Rust
|
|
64
|
+
uses: dtolnay/rust-toolchain@stable
|
|
65
|
+
- uses: Swatinem/rust-cache@v2
|
|
66
|
+
with:
|
|
67
|
+
prefix-key: bindings
|
|
68
|
+
- name: Set up Python
|
|
69
|
+
uses: actions/setup-python@v6
|
|
70
|
+
with:
|
|
71
|
+
python-version: "3.12"
|
|
72
|
+
- name: Build Python wheel (maturin)
|
|
73
|
+
run: |
|
|
74
|
+
pip install maturin
|
|
75
|
+
maturin build --release -m bindings/python/Cargo.toml
|
|
76
|
+
- name: Set up Node
|
|
77
|
+
uses: actions/setup-node@v5
|
|
78
|
+
with:
|
|
79
|
+
node-version: "22"
|
|
80
|
+
- name: Build Node addon (napi)
|
|
81
|
+
working-directory: bindings/node
|
|
82
|
+
run: |
|
|
83
|
+
npm ci
|
|
84
|
+
npx napi build --release --platform
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Rust build artifacts
|
|
2
|
+
/target/
|
|
3
|
+
/releases/
|
|
4
|
+
|
|
5
|
+
# Data directories (fallback default or manual testing)
|
|
6
|
+
/data/
|
|
7
|
+
/nodedb-data/
|
|
8
|
+
**/*.rs.bk
|
|
9
|
+
*.pdb
|
|
10
|
+
|
|
11
|
+
# IDE and Editor files
|
|
12
|
+
.vscode/
|
|
13
|
+
.idea/
|
|
14
|
+
*.swp
|
|
15
|
+
*.swo
|
|
16
|
+
*~
|
|
17
|
+
.DS_Store
|
|
18
|
+
*.iml
|
|
19
|
+
.classpath
|
|
20
|
+
.c9/
|
|
21
|
+
*.launch
|
|
22
|
+
.settings/
|
|
23
|
+
*.sublime-workspace
|
|
24
|
+
.project
|
|
25
|
+
.pydevproject
|
|
26
|
+
.cproject
|
|
27
|
+
.factorypath
|
|
28
|
+
.recommenders/
|
|
29
|
+
*.e4product
|
|
30
|
+
|
|
31
|
+
# Environment and configuration
|
|
32
|
+
.env
|
|
33
|
+
.env.local
|
|
34
|
+
.env.*.local
|
|
35
|
+
.envrc
|
|
36
|
+
resource
|
|
37
|
+
AGENTS.md
|
|
38
|
+
CLAUDE.md
|
|
39
|
+
.codex
|
|
40
|
+
|
|
41
|
+
# OS-specific
|
|
42
|
+
.DS_Store
|
|
43
|
+
.DS_Store?
|
|
44
|
+
._*
|
|
45
|
+
.Spotlight-V100
|
|
46
|
+
.Trashes
|
|
47
|
+
ehthumbs.db
|
|
48
|
+
Thumbs.db
|
|
49
|
+
*.swp
|
|
50
|
+
*.swo
|
|
51
|
+
*~
|
|
52
|
+
|
|
53
|
+
# Python
|
|
54
|
+
__pycache__/
|
|
55
|
+
*.py[cod]
|
|
56
|
+
*$py.class
|
|
57
|
+
*.so
|
|
58
|
+
.Python
|
|
59
|
+
env/
|
|
60
|
+
venv/
|
|
61
|
+
ENV/
|
|
62
|
+
build/
|
|
63
|
+
develop-eggs/
|
|
64
|
+
dist/
|
|
65
|
+
downloads/
|
|
66
|
+
eggs/
|
|
67
|
+
.eggs/
|
|
68
|
+
lib/
|
|
69
|
+
lib64/
|
|
70
|
+
parts/
|
|
71
|
+
sdist/
|
|
72
|
+
var/
|
|
73
|
+
wheels/
|
|
74
|
+
pip-wheel-metadata/
|
|
75
|
+
share/python-wheels/
|
|
76
|
+
*.egg-info/
|
|
77
|
+
.installed.cfg
|
|
78
|
+
*.egg
|
|
79
|
+
MANIFEST
|
|
80
|
+
|
|
81
|
+
# Node (if applicable)
|
|
82
|
+
node_modules/
|
|
83
|
+
npm-debug.log
|
|
84
|
+
yarn-error.log
|
|
85
|
+
|
|
86
|
+
# Benchmark and profiling
|
|
87
|
+
*.prof
|
|
88
|
+
*.flame
|
|
89
|
+
perf.data
|
|
90
|
+
perf.data.old
|
|
91
|
+
flamegraph.html
|
|
92
|
+
|
|
93
|
+
# Misc
|
|
94
|
+
.cache/
|
|
95
|
+
.pytest_cache/
|
|
96
|
+
.mypy_cache/
|
|
97
|
+
.dmypy.json
|
|
98
|
+
dmypy.json
|
|
99
|
+
*.bak
|
|
100
|
+
*.tmp
|
|
101
|
+
*.log
|
|
102
|
+
.gradle/
|
|
103
|
+
|
|
104
|
+
.cargo/
|
|
105
|
+
|
|
106
|
+
# local session scratch
|
|
107
|
+
.claude/prep/
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Contributor Covenant 3.0 Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We pledge to make our community welcoming, safe, and equitable for all.
|
|
6
|
+
|
|
7
|
+
We are committed to fostering an environment that respects and promotes the dignity, rights, and contributions of all individuals, regardless of characteristics including race, ethnicity, caste, color, age, physical characteristics, neurodiversity, disability, sex or gender, gender identity or expression, sexual orientation, language, philosophy or religion, national or social origin, socio-economic position, level of education, or other status. The same privileges of participation are extended to everyone who participates in good faith and in accordance with this Covenant.
|
|
8
|
+
|
|
9
|
+
## Encouraged Behaviors
|
|
10
|
+
|
|
11
|
+
While acknowledging differences in social norms, we all strive to meet our community's expectations for positive behavior. We also understand that our words and actions may be interpreted differently than we intend based on culture, background, or native language.
|
|
12
|
+
|
|
13
|
+
With these considerations in mind, we agree to behave mindfully toward each other and act in ways that center our shared values, including:
|
|
14
|
+
|
|
15
|
+
1. Respecting the **purpose of our community**, our activities, and our ways of gathering.
|
|
16
|
+
2. Engaging **kindly and honestly** with others.
|
|
17
|
+
3. Respecting **different viewpoints** and experiences.
|
|
18
|
+
4. **Taking responsibility** for our actions and contributions.
|
|
19
|
+
5. Gracefully giving and accepting **constructive feedback**.
|
|
20
|
+
6. Committing to **repairing harm** when it occurs.
|
|
21
|
+
7. Behaving in other ways that promote and sustain the **well-being of our community**.
|
|
22
|
+
|
|
23
|
+
## Restricted Behaviors
|
|
24
|
+
|
|
25
|
+
We agree to restrict the following behaviors in our community. Instances, threats, and promotion of these behaviors are violations of this Code of Conduct.
|
|
26
|
+
|
|
27
|
+
1. **Harassment.** Violating explicitly expressed boundaries or engaging in unnecessary personal attention after any clear request to stop.
|
|
28
|
+
2. **Character attacks.** Making insulting, demeaning, or pejorative comments directed at a community member or group of people.
|
|
29
|
+
3. **Stereotyping or discrimination.** Characterizing anyone's personality or behavior on the basis of immutable identities or traits.
|
|
30
|
+
4. **Sexualization.** Behaving in a way that would generally be considered inappropriately intimate in the context or purpose of the community.
|
|
31
|
+
5. **Violating confidentiality.** Sharing or acting on someone's personal or private information without their permission.
|
|
32
|
+
6. **Endangerment.** Causing, encouraging, or threatening violence or other harm toward any person or group.
|
|
33
|
+
7. Behaving in other ways that **threaten the well-being** of our community.
|
|
34
|
+
|
|
35
|
+
### Other Restrictions
|
|
36
|
+
|
|
37
|
+
1. **Misleading identity.** Impersonating someone else for any reason, or pretending to be someone else to evade enforcement actions.
|
|
38
|
+
2. **Failing to credit sources.** Not properly crediting the sources of content you contribute.
|
|
39
|
+
3. **Promotional materials.** Sharing marketing or other commercial content in a way that is outside the norms of the community.
|
|
40
|
+
4. **Irresponsible communication.** Failing to responsibly present content which includes, links or describes any other restricted behaviors.
|
|
41
|
+
|
|
42
|
+
## Reporting an Issue
|
|
43
|
+
|
|
44
|
+
Tensions can occur between community members even when they are trying their best to collaborate. Not every conflict represents a code of conduct violation, and this Code of Conduct reinforces encouraged behaviors and norms that can help avoid conflicts and minimize harm.
|
|
45
|
+
|
|
46
|
+
When an incident does occur, it is important to report it promptly. To report a possible violation, **contact the maintainers privately** — open a confidential report through the repository's [GitHub Security Advisories](https://github.com/nodedb-lab/code2graph/security/advisories/new), which delivers privately to the maintainers, or reach a maintainer directly. Please do **not** report violations in public issues or discussions.
|
|
47
|
+
|
|
48
|
+
Maintainers take reports of violations seriously and will make every effort to respond in a timely manner. They will investigate all reports of code of conduct violations, reviewing messages and logs, or interviewing witnesses and other participants. Maintainers will keep investigation and enforcement actions as transparent as possible while prioritizing safety and confidentiality. In order to honor these values, enforcement actions are carried out in private with the involved parties, but communicating to the whole community may be part of a mutually agreed upon resolution.
|
|
49
|
+
|
|
50
|
+
## Addressing and Repairing Harm
|
|
51
|
+
|
|
52
|
+
If an investigation by the maintainers finds that this Code of Conduct has been violated, the following enforcement ladder may be used to determine how best to repair harm, based on the incident's impact on the individuals involved and the community as a whole. Depending on the severity of a violation, lower rungs on the ladder may be skipped.
|
|
53
|
+
|
|
54
|
+
1. **Warning**
|
|
55
|
+
1. Event: A violation involving a single incident or series of incidents.
|
|
56
|
+
2. Consequence: A private, written warning from the maintainers.
|
|
57
|
+
3. Repair: Examples of repair include a private written apology, acknowledgement of responsibility, and seeking clarification on expectations.
|
|
58
|
+
2. **Temporarily Limited Activities**
|
|
59
|
+
1. Event: A repeated incidence of a violation that previously resulted in a warning, or the first incidence of a more serious violation.
|
|
60
|
+
2. Consequence: A private, written warning with a time-limited cooldown period designed to underscore the seriousness of the situation and give the community members involved time to process the incident. The cooldown period may be limited to particular communication channels or interactions with particular community members.
|
|
61
|
+
3. Repair: Examples of repair may include making an apology, using the cooldown period to reflect on actions and impact, and being thoughtful about re-entering community spaces after the period is over.
|
|
62
|
+
3. **Temporary Suspension**
|
|
63
|
+
1. Event: A pattern of repeated violation which the maintainers have tried to address with warnings, or a single serious violation.
|
|
64
|
+
2. Consequence: A private written warning with conditions for return from suspension. In general, temporary suspensions give the person being suspended time to reflect upon their behavior and possible corrective actions.
|
|
65
|
+
3. Repair: Examples of repair include respecting the spirit of the suspension, meeting the specified conditions for return, and being thoughtful about how to reintegrate with the community when the suspension is lifted.
|
|
66
|
+
4. **Permanent Ban**
|
|
67
|
+
1. Event: A pattern of repeated code of conduct violations that other steps on the ladder have failed to resolve, or a violation so serious that the maintainers determine there is no way to keep the community safe with this person as a member.
|
|
68
|
+
2. Consequence: Access to all community spaces, tools, and communication channels is removed. In general, permanent bans should be rarely used, should have strong reasoning behind them, and should only be resorted to if working through other remedies has failed to change the behavior.
|
|
69
|
+
3. Repair: There is no possible repair in cases of this severity.
|
|
70
|
+
|
|
71
|
+
This enforcement ladder is intended as a guideline. It does not limit the ability of maintainers to use their discretion and judgment, in keeping with the best interests of our community.
|
|
72
|
+
|
|
73
|
+
## Scope
|
|
74
|
+
|
|
75
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public or other 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.
|
|
76
|
+
|
|
77
|
+
## Attribution
|
|
78
|
+
|
|
79
|
+
This Code of Conduct is adapted from the Contributor Covenant, version 3.0, permanently available at [https://www.contributor-covenant.org/version/3/0/](https://www.contributor-covenant.org/version/3/0/).
|
|
80
|
+
|
|
81
|
+
Contributor Covenant is stewarded by the Organization for Ethical Source and licensed under CC BY-SA 4.0. To view a copy of this license, visit [https://creativecommons.org/licenses/by-sa/4.0/](https://creativecommons.org/licenses/by-sa/4.0/).
|
|
82
|
+
|
|
83
|
+
For answers to common questions about Contributor Covenant, see the FAQ at [https://www.contributor-covenant.org/faq](https://www.contributor-covenant.org/faq). Translations are provided at [https://www.contributor-covenant.org/translations](https://www.contributor-covenant.org/translations). Additional enforcement and community guideline resources can be found at [https://www.contributor-covenant.org/resources](https://www.contributor-covenant.org/resources). The enforcement ladder was inspired by the work of [Mozilla's code of conduct team](https://github.com/mozilla/inclusion).
|