Skip to content

Commit ccd4dfd

Browse files
merge: resolve conflict in embedder.js imports
Impact: 13 functions changed, 34 affected
2 parents 4f78c39 + 201f671 commit ccd4dfd

14 files changed

Lines changed: 1500 additions & 62 deletions

File tree

.github/workflows/publish.yml

Lines changed: 153 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -66,25 +66,9 @@ jobs:
6666
echo "Stable release (manual retry): $VERSION"
6767
else
6868
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT"
69-
BASE_PATCH=$((PATCH + 1))
69+
DEV_PATCH=$((PATCH + 1))
7070
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
71-
72-
# Query npm for the highest dev patch number published so far
73-
LATEST_DEV=$(npm view "@optave/codegraph" versions --json 2>/dev/null \
74-
| node -e "
75-
const versions = JSON.parse(require('fs').readFileSync(0,'utf8'));
76-
const prefix = '${MAJOR}.${MINOR}.';
77-
let maxPatch = ${BASE_PATCH} - 1;
78-
for (const v of (Array.isArray(versions) ? versions : [versions])) {
79-
if (v.startsWith(prefix) && v.includes('-dev.')) {
80-
const patch = parseInt(v.split('.')[2], 10);
81-
if (patch > maxPatch) maxPatch = patch;
82-
}
83-
}
84-
console.log(maxPatch + 1);
85-
" 2>/dev/null) || LATEST_DEV="$BASE_PATCH"
86-
87-
VERSION="${MAJOR}.${MINOR}.${LATEST_DEV}-dev.${SHORT_SHA}"
71+
VERSION="${MAJOR}.${MINOR}.${DEV_PATCH}-dev.${SHORT_SHA}"
8872
NPM_TAG="dev"
8973
echo "Dev release: $VERSION"
9074
fi
@@ -152,7 +136,158 @@ jobs:
152136
path: crates/codegraph-core/*.node
153137
if-no-files-found: error
154138

139+
# ── Dev builds: GitHub pre-release with tarballs ──
140+
141+
publish-dev:
142+
if: github.event_name == 'push'
143+
needs: [compute-version, build-native]
144+
runs-on: ubuntu-latest
145+
permissions:
146+
contents: write
147+
148+
steps:
149+
- uses: actions/checkout@v4
150+
151+
- uses: actions/setup-node@v4
152+
with:
153+
node-version: "22"
154+
155+
- run: npm install
156+
157+
- name: Set version
158+
env:
159+
VERSION: ${{ needs.compute-version.outputs.version }}
160+
run: |
161+
npm version "$VERSION" --no-git-tag-version --allow-same-version
162+
node scripts/sync-native-versions.js
163+
echo "Packaging version $VERSION"
164+
165+
- name: Disable prepublishOnly
166+
run: npm pkg delete scripts.prepublishOnly
167+
168+
- name: Download native artifacts
169+
uses: actions/download-artifact@v4
170+
with:
171+
path: ${{ runner.temp }}/artifacts/
172+
173+
- name: Pack main package
174+
run: npm pack
175+
176+
- name: Pack platform packages
177+
env:
178+
VERSION: ${{ needs.compute-version.outputs.version }}
179+
shell: bash
180+
run: |
181+
declare -A PACKAGES=(
182+
["linux-x64"]="@optave/codegraph-linux-x64-gnu"
183+
["darwin-arm64"]="@optave/codegraph-darwin-arm64"
184+
["darwin-x64"]="@optave/codegraph-darwin-x64"
185+
["win32-x64"]="@optave/codegraph-win32-x64-msvc"
186+
)
187+
188+
ARTIFACTS="${RUNNER_TEMP}/artifacts"
189+
PKG_DIR="${RUNNER_TEMP}/pkg"
190+
191+
for artifact_dir in "${ARTIFACTS}"/native-*/; do
192+
platform=$(basename "$artifact_dir" | sed 's/^native-//')
193+
pkg_name=${PACKAGES[$platform]}
194+
node_os=${platform%%-*}
195+
node_arch=${platform##*-}
196+
197+
mkdir -p "${PKG_DIR}/$platform"
198+
cp "$artifact_dir"/*.node "${PKG_DIR}/$platform/codegraph-core.node"
199+
200+
cat > "${PKG_DIR}/$platform/package.json" <<PKGJSON
201+
{
202+
"name": "${pkg_name}",
203+
"version": "${VERSION}",
204+
"description": "Native codegraph-core binary for ${node_os}-${node_arch}",
205+
"os": ["${node_os}"],
206+
"cpu": ["${node_arch}"],
207+
"main": "codegraph-core.node",
208+
"files": ["codegraph-core.node"],
209+
"license": "Apache-2.0",
210+
"repository": {
211+
"type": "git",
212+
"url": "https://github.com/optave/codegraph.git"
213+
}
214+
}
215+
PKGJSON
216+
217+
npm pack "${PKG_DIR}/$platform"
218+
done
219+
220+
- name: Create GitHub pre-release
221+
env:
222+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
223+
VERSION: ${{ needs.compute-version.outputs.version }}
224+
run: |
225+
TAG="dev-v${VERSION}"
226+
gh release create "$TAG" \
227+
--prerelease \
228+
--title "Dev build ${VERSION}" \
229+
--notes "Dev build from commit \`${{ github.sha }}\` on \`main\`." \
230+
*.tgz
231+
232+
- name: Prune old dev releases
233+
env:
234+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
235+
run: |
236+
# List dev releases sorted newest-first, skip the first 5, delete the rest
237+
# Non-critical: failures here should not fail the workflow
238+
TAGS=$(gh release list --limit 100 --json tagName,isPrerelease,createdAt 2>&1) || {
239+
echo "::warning::Failed to list releases for pruning: ${TAGS}"
240+
exit 0
241+
}
242+
243+
OLD_TAGS=$(echo "$TAGS" | jq -r '
244+
[ .[] | select(.isPrerelease and (.tagName | startswith("dev-v"))) ]
245+
| sort_by(.createdAt) | reverse
246+
| .[5:]
247+
| .[].tagName
248+
' 2>&1) || {
249+
echo "::warning::Failed to parse release list for pruning: ${OLD_TAGS}"
250+
exit 0
251+
}
252+
253+
# When fewer than 5 dev releases exist, OLD_TAGS is empty and the loop is a no-op
254+
echo "$OLD_TAGS" | while read -r tag; do
255+
[ -z "$tag" ] && continue
256+
echo "Deleting old dev release: $tag"
257+
gh release delete "$tag" --yes --cleanup-tag || echo "::warning::Failed to delete release ${tag}"
258+
done
259+
260+
- name: Summary
261+
env:
262+
VERSION: ${{ needs.compute-version.outputs.version }}
263+
run: |
264+
TAG="dev-v${VERSION}"
265+
cat >> "$GITHUB_STEP_SUMMARY" <<EOF
266+
## Dev Build Published
267+
268+
**Version:** \`${VERSION}\`
269+
**Commit:** \`${{ github.sha }}\`
270+
271+
### Download
272+
273+
Tarballs attached to [GitHub release \`${TAG}\`](${{ github.server_url }}/${{ github.repository }}/releases/tag/${TAG}).
274+
275+
\`\`\`bash
276+
# Install the main package (uses WASM fallback):
277+
npm install ${{ github.server_url }}/${{ github.repository }}/releases/download/${TAG}/optave-codegraph-${VERSION}.tgz
278+
279+
# For native performance, also install your platform package:
280+
# Linux x64:
281+
npm install ${{ github.server_url }}/${{ github.repository }}/releases/download/${TAG}/optave-codegraph-linux-x64-gnu-${VERSION}.tgz
282+
# macOS arm64:
283+
npm install ${{ github.server_url }}/${{ github.repository }}/releases/download/${TAG}/optave-codegraph-darwin-arm64-${VERSION}.tgz
284+
\`\`\`
285+
EOF
286+
287+
# ── Stable releases: publish to npm ──
288+
155289
publish:
290+
if: github.event_name != 'push'
156291
needs: [compute-version, build-native]
157292
runs-on: ubuntu-latest
158293
environment: npm-publish
@@ -179,7 +314,6 @@ jobs:
179314
- run: npm install
180315

181316
- name: Set version
182-
id: version
183317
env:
184318
VERSION: ${{ needs.compute-version.outputs.version }}
185319
run: |
@@ -270,20 +404,15 @@ jobs:
270404
NPM_TAG: ${{ needs.compute-version.outputs.npm_tag }}
271405
run: npm publish --access public --provenance --tag "$NPM_TAG"
272406

273-
# ── Stable-only: version bump PR and tag ──
274-
275407
- name: Configure git
276-
if: github.event_name != 'push'
277408
run: |
278409
git config user.name "github-actions[bot]"
279410
git config user.email "github-actions[bot]@users.noreply.github.com"
280411
281412
- name: Generate DEPENDENCIES.json
282-
if: github.event_name != 'push'
283413
run: mkdir -p generated && npm ls --json --all --omit=dev > generated/DEPENDENCIES.json 2>/dev/null || true
284414

285415
- name: Push version bump via PR
286-
if: github.event_name != 'push'
287416
env:
288417
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
289418
VERSION: ${{ needs.compute-version.outputs.version }}
@@ -313,25 +442,3 @@ jobs:
313442
git tag -a "$TAG" -m "release: $TAG"
314443
git push origin "$TAG"
315444
fi
316-
317-
# ── Dev-only: summary with install instructions ──
318-
319-
- name: Summary
320-
if: github.event_name == 'push'
321-
env:
322-
VERSION: ${{ needs.compute-version.outputs.version }}
323-
run: |
324-
cat >> "$GITHUB_STEP_SUMMARY" <<EOF
325-
## Dev Release Published
326-
327-
**Version:** \`${VERSION}\`
328-
**Commit:** \`${{ github.sha }}\`
329-
330-
### Install
331-
332-
\`\`\`bash
333-
npm install @optave/codegraph@dev
334-
# or pin this exact version:
335-
npm install @optave/codegraph@${VERSION}
336-
\`\`\`
337-
EOF

docs/roadmap/BACKLOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ Non-breaking, ordered by problem-fit:
3737
| 13 | Architecture boundary rules | User-defined rules for allowed/forbidden dependencies between modules (e.g., "controllers must not import from other controllers"). Violations flagged in `diff-impact` and CI. Inspired by codegraph-rust, stratify. | Architecture | Prevents architectural decay in CI; agents are warned before introducing forbidden cross-module dependencies ||| 3 | No |
3838
| 15 | Hybrid BM25 + semantic search | Combine BM25 keyword matching with embedding-based semantic search using Reciprocal Rank Fusion. Better recall than either approach alone. Inspired by GitNexus, claude-context-local. | Search | Search results improve dramatically — keyword matches catch exact names, embeddings catch conceptual matches, RRF merges both ||| 3 | No |
3939
| 18 | CODEOWNERS integration | Map graph nodes to CODEOWNERS entries. Show who owns each function, surface ownership boundaries in `diff-impact`. Inspired by CKB. | Developer Experience | `diff-impact` tells agents which teams to notify; ownership-aware impact analysis reduces missed reviews ||| 3 | No |
40+
| 22 | Manifesto-driven pass/fail | User-defined rule engine with custom thresholds (e.g. "cognitive > 15 = fail", "cyclomatic > 10 = fail", "imports > 10 = decompose"). Outputs pass/fail per function/file. Generalizes ID 13 (boundary rules) into a generic rule system. | Analysis | Enables autonomous multi-agent audit workflows (GAUNTLET pattern); CI integration for code health gates with configurable thresholds ||| 3 | No |
4041
| 6 | Formal code health metrics | Cyclomatic complexity, Maintainability Index, and Halstead metrics per function — we already parse the AST, the data is there. Inspired by code-health-meter (published in ACM TOSEM 2025). | Analysis | Agents can prioritize refactoring targets; `hotspots` becomes richer with quantitative health scores per function ||| 2 | No |
4142
| 7 | OWASP/CWE pattern detection | Security pattern scanning on the existing AST — hardcoded secrets, SQL injection patterns, eval usage, XSS sinks. Lightweight static rules, not full taint analysis. Inspired by narsil-mcp, CKB. | Security | Catches low-hanging security issues during `diff-impact`; agents can flag risky patterns before they're committed ||| 2 | No |
4243
| 11 | Community detection | Leiden/Louvain algorithm to discover natural module boundaries vs actual file organization. Reveals which symbols are tightly coupled and whether the directory structure matches. Inspired by axon, GitNexus, CodeGraphMCPServer. | Intelligence | Surfaces architectural drift — when directory structure no longer matches actual dependency clusters; guides refactoring ||| 2 | No |
44+
| 21 | Cognitive + cyclomatic complexity | Cognitive Complexity (SonarSource) as the primary readability metric — penalizes nesting, so it subsumes nesting depth analysis. Cyclomatic complexity (McCabe) as secondary testability metric. Both computed from existing tree-sitter AST in a single traversal. Cognitive > 15 or cyclomatic > 10 = flag for refactoring. Extends ID 6 with the two most actionable metrics. | Analysis | Agents can flag hard-to-understand and hard-to-test functions in one pass; cognitive complexity captures both decision complexity and nesting depth in a single score ||| 2 | No |
4345

4446
Breaking (penalized to end of tier):
4547

@@ -90,3 +92,4 @@ When filling in the assessment columns during a prioritization session:
9092
- **3** — Useful for developers and agents but doesn't address the core "lost AI" problem
9193
- **2** — Nice-to-have; improves the tool but tangential to the stated problem
9294
- **1** — Cool feature, but doesn't help AI agents navigate codebases better
95+

0 commit comments

Comments
 (0)