From a6d00a8bb4b3eabaace30db73bbe453149ad20f6 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Thu, 2 Jul 2026 18:25:50 +0800 Subject: [PATCH 01/54] chore: Added tests & typecheck step --- .github/workflows/ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 817e411a..13428906 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -84,5 +84,14 @@ jobs: - name: Rust Security & Quality (Clippy) run: cargo clippy -- -D warnings + - name: Run Rust Tests + run: | + cargo test --locked + cargo test --features node --locked + cargo test --features wasm --locked + + - name: Run Typecheck + run: npm run typecheck + - name: Final Build Check (TypeScript) run: npm run build From 057721c7cdbbeacdef6fd51579b20045012672d3 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Thu, 2 Jul 2026 18:27:32 +0800 Subject: [PATCH 02/54] chore: Added tests & typecheck step --- .github/workflows/ci.yml | 11 +++++------ package.json | 2 +- scripts/test-rust.js | 29 +++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 scripts/test-rust.js diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 13428906..91967cd1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,13 +85,12 @@ jobs: run: cargo clippy -- -D warnings - name: Run Rust Tests - run: | - cargo test --locked - cargo test --features node --locked - cargo test --features wasm --locked + run: npm run test:rust - - name: Run Typecheck - run: npm run typecheck + - name: Run Typecheck & Tests + run: | + npm run typecheck + npm run test:ts - name: Final Build Check (TypeScript) run: npm run build diff --git a/package.json b/package.json index f55e0a72..61a4a639 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "./types" ], "scripts": { - "test:rust": "cargo test", + "test:rust": "nodr ./scripts/test-rust.js", "test:ts": "node ./scripts/run-tests.js", "bench:rust": "cargo bench", "bench:ts": "node ./scripts/ts-bench.js", diff --git a/scripts/test-rust.js b/scripts/test-rust.js new file mode 100644 index 00000000..6ecb634f --- /dev/null +++ b/scripts/test-rust.js @@ -0,0 +1,29 @@ +/** + * Copyright 2026 SoTeen Studio + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +import { execSync } from 'child_process'; + +function runCommand(command) { + try { + console.log(`Running: ${command}`); + execSync(command, { stdio: 'inherit' }); + } catch (error) { + console.error(`Error executing: ${command}`); + process.exit(1); + } +} + +console.log('Starting Rust tests...'); + +runCommand('cargo test --locked'); +runCommand('cargo test --features node --locked'); +runCommand('cargo test --features wasm --locked'); + +console.log('All Rust tests passed successfully!'); From a192932c3f5a969deee56b7b3d65a66df9c657bb Mon Sep 17 00:00:00 2001 From: Claycuy Date: Thu, 2 Jul 2026 20:41:58 +0800 Subject: [PATCH 03/54] chore: Fix package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 61a4a639..5a09850e 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "./types" ], "scripts": { - "test:rust": "nodr ./scripts/test-rust.js", + "test:rust": "node ./scripts/test-rust.js", "test:ts": "node ./scripts/run-tests.js", "bench:rust": "cargo bench", "bench:ts": "node ./scripts/ts-bench.js", From db61662479e7423a63c5fba414bab35c8c6a3048 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Fri, 3 Jul 2026 08:36:11 +0800 Subject: [PATCH 04/54] fix: Unitry unit tests --- ts/tests/vmerror.test.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ts/tests/vmerror.test.ts b/ts/tests/vmerror.test.ts index 3ce062d8..8aa816e2 100644 --- a/ts/tests/vmerror.test.ts +++ b/ts/tests/vmerror.test.ts @@ -16,16 +16,17 @@ const { VMError } = await importVM(); describe("VMError Class", () => { test("VMError: should correctly set properties and format message", () => { const msg = "Something went wrong"; - const err = new VMError(msg); + const details = ["test", "there is testing"]; + const err = new VMError(msg, details); expect(err.code).toBe("LVM500"); expect(err.ip).toBe(0); expect(err).toBeInstanceOf(VMError); - expect(err.name).toBe("SystemError"); + expect(err.name).toBe(""); - expect(err.message).toContain(msg); - expect(err.message).toContain("LVM500"); + expect(err.hintDetails.length).toBe(2); + expect(err.code).toContain("LVM500"); }); test("VMError: should be throwable", () => { From 2ea1dd38c078ad9e4b34050dbd0a26ea07f928be Mon Sep 17 00:00:00 2001 From: Claycuy Date: Fri, 3 Jul 2026 08:41:17 +0800 Subject: [PATCH 05/54] chore: Update Cargo.toml --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fd5371fb..7383cca1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -721,9 +721,9 @@ checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" [[package]] name = "rustc-hash" -version = "2.1.2" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" [[package]] name = "rustversion" From 74ceca15325cdae074778c35c14b79ec6d875b9a Mon Sep 17 00:00:00 2001 From: Claycuy Date: Fri, 3 Jul 2026 09:07:44 +0800 Subject: [PATCH 06/54] chore: Resolve lockfile conflict and sync --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 7383cca1..ae3551d2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -461,7 +461,7 @@ checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" [[package]] name = "lightvm" -version = "0.1.0-alpha.8-nightly.20260701.305f0b7" +version = "0.1.0-alpha.8-nightly.20260702.4e8db80" dependencies = [ "ahash", "backtrace", From 25a0da57645d3dc1cca9e42fc37134f038d4df17 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Fri, 3 Jul 2026 09:12:23 +0800 Subject: [PATCH 07/54] ci: Fix run typecheck & tests step --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 91967cd1..a017c86e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -91,6 +91,7 @@ jobs: run: | npm run typecheck npm run test:ts + node ./scripts/fix-imports.js - name: Final Build Check (TypeScript) run: npm run build From 97d38f3da679261593400170fd34be9425dd5dea Mon Sep 17 00:00:00 2001 From: Claycuy Date: Fri, 3 Jul 2026 09:16:34 +0800 Subject: [PATCH 08/54] ci: Fix run typecheck & tests step --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a017c86e..798b3c41 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -91,7 +91,7 @@ jobs: run: | npm run typecheck npm run test:ts - node ./scripts/fix-imports.js + node ./scripts/fix-imports.js - name: Final Build Check (TypeScript) run: npm run build From 92bcae2ed1785d611b097217b7d84e258c003a74 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Fri, 3 Jul 2026 09:20:30 +0800 Subject: [PATCH 09/54] ci: Fix run typecheck & tests step --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 798b3c41..9603beea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,13 +85,14 @@ jobs: run: cargo clippy -- -D warnings - name: Run Rust Tests - run: npm run test:rust + run: | + npm run test:rust + node ./scripts/fix-imports.js - name: Run Typecheck & Tests run: | npm run typecheck npm run test:ts - node ./scripts/fix-imports.js - name: Final Build Check (TypeScript) run: npm run build From 2c27f6c0da9367a568a0c153d94d4eb100bd8dfc Mon Sep 17 00:00:00 2001 From: Claycuy Date: Fri, 3 Jul 2026 13:42:05 +0800 Subject: [PATCH 10/54] ci: Upgrade build ci --- .github/workflows/nightly.yml | 26 +++++++++ .github/workflows/production.yml | 93 ++++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 .github/workflows/production.yml diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 226206f2..2f6e5c99 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -16,6 +16,32 @@ jobs: with: fetch-depth: 0 + - name: Check if Production Workflow ran today + id: check_prod + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Ambil tanggal hari ini (UTC) + TODAY=$(date -u +'%Y-%m-%d') + + # Cari run terakhir dari workflow 'production.yml' (sesuaikan nama filenya) + # Kita cek apakah ada yg jalan hari ini + RUNS=$(gh run list --workflow production.yml --limit 1 --json createdAt --jq '.[0].createdAt') + + if [[ "$RUNS" == "$TODAY"* ]]; then + echo "Prod sudah jalan hari ini: $RUNS" + echo "should_skip=true" >> $GITHUB_OUTPUT + else + echo "Prod belum jalan hari ini." + echo "should_skip=false" >> $GITHUB_OUTPUT + fi + + - name: Stop if Prod already ran + if: steps.check_prod.outputs.should_skip == 'true' + run: | + echo "Prod sudah jalan, nightly cabut dulu ya. Bye!" + exit 0 + - name: Filter Significant Changes id: filter_changes run: | diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml new file mode 100644 index 00000000..68f172c1 --- /dev/null +++ b/.github/workflows/production.yml @@ -0,0 +1,93 @@ +name: Production Release + +on: + workflow_dispatch: + inputs: + version: + description: 'Versi rilis (contoh: 1.1.0)' + required: true + +jobs: + production-release: + runs-on: ubuntu-latest + permissions: + contents: write + actions: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Validate Version & Check Tag + run: | + VERSION="${{ github.event.inputs.version }}" + # Cek apakah tag sudah ada + if git rev-parse "v$VERSION" >/dev/null 2>&1; then + echo "Error: Versi $VERSION sudah ada tag-nya! Ganti versi dulu." + exit 1 + fi + + # Cek apakah file sudah terupdate versinya (pakai package.json sebagai acuan) + FILE_VERSION=$(jq -r .version package.json) + if [ "$FILE_VERSION" != "$VERSION" ]; then + echo "Error: Versi di package.json ($FILE_VERSION) tidak sama dengan input ($VERSION)." + exit 1 + fi + + - name: Generate Release Notes + run: | + VERSION="${{ github.event.inputs.version }}" + + # 1. Cari tag stable terakhir (yang bukan nightly) + LAST_STABLE=$(git tag --sort=-creatordate | grep -v "nightly" | head -n 1 || echo "") + + # 2. Ambil semua tag nightly, lalu sort pakai -V (Version Sort) + # Kita filter yang lebih baru dari LAST_STABLE + # Asumsi: LAST_STABLE (misal v0.1.0-alpha.8) tidak mengandung "nightly" + + NIGHTLIES=$(git tag | grep "nightly" | sort -V) + + # Filter nightly yang muncul SETELAH stable terakhir + # Kalau belum ada stable, ambil semua + if [ -n "$LAST_STABLE" ]; then + # Kita filter nightly yang secara versi lebih besar dari last stable + # Karena tag nightly biasanya punya format: v0.1.0-alpha.8-nightly.xxx + FINAL_NIGHTLIES=$(echo "$NIGHTLIES" | awk -v last="$LAST_STABLE" '$0 > last') + else + FINAL_NIGHTLIES="$NIGHTLIES" + fi + + { + echo "Release based on Changelogs:" + if [ -n "$FINAL_NIGHTLIES" ]; then + echo "$FINAL_NIGHTLIES" | sed 's/^/* /' + else + echo "* No previous nightly builds." + fi + echo "" + echo "***Lion Owl caught in apple net!***" + } > release_notes.md + + - name: Create Release + run: | + VERSION="${{ github.event.inputs.version }}" + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + # Tagging + git tag "v$VERSION" + git push origin "v$VERSION" + + # Create Release + gh release create "v$VERSION" \ + --title "Release $VERSION" \ + --notes-file release_notes.md + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Trigger Build and Publish + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: Build and Publish N-API + token: ${{ secrets.GITHUB_TOKEN }} + inputs: '{ "version_override": "${{ github.event.inputs.version }}" }' From 81c1e438138de7b61e38fe4427e8c222e3607b44 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Fri, 3 Jul 2026 17:27:04 +0800 Subject: [PATCH 11/54] chore: Delete comment in ci --- .github/workflows/nightly.yml | 25 ------------------------- .github/workflows/production.yml | 13 ------------- 2 files changed, 38 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 2f6e5c99..d6d1919b 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -21,11 +21,8 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - # Ambil tanggal hari ini (UTC) TODAY=$(date -u +'%Y-%m-%d') - # Cari run terakhir dari workflow 'production.yml' (sesuaikan nama filenya) - # Kita cek apakah ada yg jalan hari ini RUNS=$(gh run list --workflow production.yml --limit 1 --json createdAt --jq '.[0].createdAt') if [[ "$RUNS" == "$TODAY"* ]]; then @@ -45,18 +42,14 @@ jobs: - name: Filter Significant Changes id: filter_changes run: | - # Ambil tag terakhir PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") - # Ambil semua commit log sejak tag terakhir - # Kalau belum ada tag, ambil semua history if [ -n "$PREV_TAG" ]; then LOGS=$(git log $PREV_TAG..HEAD --pretty=format:"%s") else LOGS=$(git log --pretty=format:"%s") fi - # Cari apakah ada commit yang diawali "feat" atau "fix" HAS_SIGNIFICANT=$(echo "$LOGS" | grep -E "^(feat|fix)(\(.*\))?:" || echo "") if [ -n "$HAS_SIGNIFICANT" ]; then @@ -90,21 +83,15 @@ jobs: id: versioning if: steps.filter_changes.outputs.significant == 'true' run: | - # 1. Ambil tag terakhir RAW_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0") - # 2. Hapus prefix 'v' kalau ada CLEAN_VERSION=${RAW_TAG#v} - # 3. Hapus bagian '-nightly.*' kalau ada BASE_VERSION=${CLEAN_VERSION%-nightly.*} - # 4. Ambil hash baru dan tanggal hari ini COMMIT_HASH=$(git rev-parse --short HEAD) DATE=$(date +'%Y%m%d') # Format: 20260625 - # 5. Bikin format versi baru: 0.1.0-alpha.8-nightly.20260625.hash - # Kita asumsikan BASE_VERSION udah termasuk "-alpha.8" nya VERSION_CLEAN="${BASE_VERSION}-nightly.${DATE}.${COMMIT_HASH}" VERSION_TAG="v${VERSION_CLEAN}" @@ -117,17 +104,12 @@ jobs: run: | VERSION="${{ steps.versioning.outputs.version_clean }}" - # Update Cargo.toml sed -i "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml - # Update package.json if [ -f "package.json" ]; then jq --arg ver "$VERSION" '.version = $ver' package.json > temp.json && mv temp.json package.json fi - # UPDATE LOCKFILE: - # Kita jalanin cargo generate-lockfile atau update - # Pake --offline kalau lu mau cepat, tapi biar aman pake command ini: rustup toolchain install stable --profile minimal cargo update @@ -140,7 +122,6 @@ jobs: git add Cargo.toml [ -f "package.json" ] && git add package.json - # Cuma commit kalau ada perubahan if ! git diff --cached --quiet; then git commit -m "chore: nightly release ${{ steps.versioning.outputs.version_clean }}" git tag ${{ steps.versioning.outputs.version_tag }} @@ -154,17 +135,13 @@ jobs: run: | PREV_TAG=$(git describe --tags --abbrev=0 --exclude="${{ steps.versioning.outputs.version_tag }}" 2>/dev/null || echo "") - # Ambil log dengan format: type: subject LOGS=$(git log $PREV_TAG..HEAD --pretty=format:"%s") - # Tambahin spasi setelah titik dua atau kurung buka FEAT=$(echo "$LOGS" | grep -E "^feat(\(.*\))?: " | sed -E 's/^feat(\(.*\))?: /- /' || echo "") FIX=$(echo "$LOGS" | grep -E "^fix(\(.*\))?: " | sed -E 's/^fix(\(.*\))?: /- /' || echo "") - # Bikin link compare COMPARE_LINK="https://github.com/${{ github.repository }}/compare/${PREV_TAG}...${{ steps.versioning.outputs.version_tag }}" - # Susun formatnya { echo "## What's Changed" echo "Compare: $COMPARE_LINK" @@ -189,7 +166,6 @@ jobs: echo "***Nightly Owl has fallen out of bed tonight!***" } > release_notes.md - # 2. Buat release pakai file notes gh release create "${{ steps.versioning.outputs.version_tag }}" \ --title "Nightly Build ${{ steps.versioning.outputs.version_tag }}" \ --notes-file release_notes.md \ @@ -198,7 +174,6 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Trigger Main Release Workflow - # Step ini cuma jalan kalau step sebelumnya sukses if: steps.filter_changes.outputs.significant == 'true' uses: benc-uk/workflow-dispatch@v1 with: diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml index 68f172c1..90b1bbf4 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/production.yml @@ -21,13 +21,11 @@ jobs: - name: Validate Version & Check Tag run: | VERSION="${{ github.event.inputs.version }}" - # Cek apakah tag sudah ada if git rev-parse "v$VERSION" >/dev/null 2>&1; then echo "Error: Versi $VERSION sudah ada tag-nya! Ganti versi dulu." exit 1 fi - # Cek apakah file sudah terupdate versinya (pakai package.json sebagai acuan) FILE_VERSION=$(jq -r .version package.json) if [ "$FILE_VERSION" != "$VERSION" ]; then echo "Error: Versi di package.json ($FILE_VERSION) tidak sama dengan input ($VERSION)." @@ -38,20 +36,11 @@ jobs: run: | VERSION="${{ github.event.inputs.version }}" - # 1. Cari tag stable terakhir (yang bukan nightly) LAST_STABLE=$(git tag --sort=-creatordate | grep -v "nightly" | head -n 1 || echo "") - # 2. Ambil semua tag nightly, lalu sort pakai -V (Version Sort) - # Kita filter yang lebih baru dari LAST_STABLE - # Asumsi: LAST_STABLE (misal v0.1.0-alpha.8) tidak mengandung "nightly" - NIGHTLIES=$(git tag | grep "nightly" | sort -V) - # Filter nightly yang muncul SETELAH stable terakhir - # Kalau belum ada stable, ambil semua if [ -n "$LAST_STABLE" ]; then - # Kita filter nightly yang secara versi lebih besar dari last stable - # Karena tag nightly biasanya punya format: v0.1.0-alpha.8-nightly.xxx FINAL_NIGHTLIES=$(echo "$NIGHTLIES" | awk -v last="$LAST_STABLE" '$0 > last') else FINAL_NIGHTLIES="$NIGHTLIES" @@ -74,11 +63,9 @@ jobs: git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - # Tagging git tag "v$VERSION" git push origin "v$VERSION" - # Create Release gh release create "v$VERSION" \ --title "Release $VERSION" \ --notes-file release_notes.md From 5b7289e942aea9cf7bab6d4be4e31b32fc8ef7ea Mon Sep 17 00:00:00 2001 From: Claycuy Date: Fri, 3 Jul 2026 18:04:30 +0800 Subject: [PATCH 12/54] ci: Refactor nightly build --- .github/scripts/nightly/conmit_push.sh | 13 ++ .github/scripts/nightly/create_release.sh | 38 ++++++ .github/scripts/nightly/filter_significant.sh | 17 +++ .github/scripts/nightly/generate_version.sh | 15 +++ .../scripts/nightly/production_workflow.sh | 11 ++ .github/scripts/nightly/update_files.sh | 10 ++ .github/workflows/nightly.yml | 117 ++---------------- 7 files changed, 111 insertions(+), 110 deletions(-) create mode 100644 .github/scripts/nightly/conmit_push.sh create mode 100644 .github/scripts/nightly/create_release.sh create mode 100644 .github/scripts/nightly/filter_significant.sh create mode 100644 .github/scripts/nightly/generate_version.sh create mode 100644 .github/scripts/nightly/production_workflow.sh create mode 100644 .github/scripts/nightly/update_files.sh diff --git a/.github/scripts/nightly/conmit_push.sh b/.github/scripts/nightly/conmit_push.sh new file mode 100644 index 00000000..135f492b --- /dev/null +++ b/.github/scripts/nightly/conmit_push.sh @@ -0,0 +1,13 @@ +git config user.name "github-actions[bot]" +git config user.email "github-actions[bot]@users.noreply.github.com" + +git add Cargo.toml +[ -f "package.json" ] && git add package.json + +if ! git diff --cached --quiet; then + git commit -m "chore: nightly release ${{ steps.versioning.outputs.version_clean }}" + git tag ${{ steps.versioning.outputs.version_tag }} + git push origin main --tags +else + echo "No file changes, skip push." +fi \ No newline at end of file diff --git a/.github/scripts/nightly/create_release.sh b/.github/scripts/nightly/create_release.sh new file mode 100644 index 00000000..cd2330c7 --- /dev/null +++ b/.github/scripts/nightly/create_release.sh @@ -0,0 +1,38 @@ +PREV_TAG=$(git describe --tags --abbrev=0 --exclude="${{ steps.versioning.outputs.version_tag }}" 2>/dev/null || echo "") + +LOGS=$(git log $PREV_TAG..HEAD --pretty=format:"%s") + +FEAT=$(echo "$LOGS" | grep -E "^feat(\(.*\))?: " | sed -E 's/^feat(\(.*\))?: /- /' || echo "") +FIX=$(echo "$LOGS" | grep -E "^fix(\(.*\))?: " | sed -E 's/^fix(\(.*\))?: /- /' || echo "") + +COMPARE_LINK="https://github.com/${{ github.repository }}/compare/${PREV_TAG}...${{ steps.versioning.outputs.version_tag }}" + +{ + echo "## What's Changed" + echo "Compare: $COMPARE_LINK" + echo "" + + if [ -n "$FEAT" ]; then + echo "### Features" + echo "$FEAT" + echo "" + fi + + if [ -n "$FIX" ]; then + echo "### Fixes" + echo "$FIX" + echo "" + fi + + if [ -z "$FEAT" ] && [ -z "$FIX" ]; then + echo "_No significant changes in this build._" + echo "" + fi + + echo "***Nightly Owl has fallen out of bed tonight!***" +} > release_notes.md + +gh release create "${{ steps.versioning.outputs.version_tag }}" \ + --title "Nightly Build ${{ steps.versioning.outputs.version_tag }}" \ + --notes-file release_notes.md \ + --prerelease \ No newline at end of file diff --git a/.github/scripts/nightly/filter_significant.sh b/.github/scripts/nightly/filter_significant.sh new file mode 100644 index 00000000..cb01b290 --- /dev/null +++ b/.github/scripts/nightly/filter_significant.sh @@ -0,0 +1,17 @@ +PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") + +if [ -n "$PREV_TAG" ]; then + LOGS=$(git log $PREV_TAG..HEAD --pretty=format:"%s") +else + LOGS=$(git log --pretty=format:"%s") +fi + +HAS_SIGNIFICANT=$(echo "$LOGS" | grep -E "^(feat|fix)(\(.*\))?:" || echo "") + +if [ -n "$HAS_SIGNIFICANT" ]; then + echo "significant=true" >> $GITHUB_OUTPUT + echo "There are significant changes, continue!" +else + echo "significant=false" >> $GITHUB_OUTPUT + echo "No feat/fix, skip build." +fi \ No newline at end of file diff --git a/.github/scripts/nightly/generate_version.sh b/.github/scripts/nightly/generate_version.sh new file mode 100644 index 00000000..54d5bfae --- /dev/null +++ b/.github/scripts/nightly/generate_version.sh @@ -0,0 +1,15 @@ +RAW_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0") + +CLEAN_VERSION=${RAW_TAG#v} + +BASE_VERSION=${CLEAN_VERSION%-nightly.*} + +COMMIT_HASH=$(git rev-parse --short HEAD) +DATE=$(date +'%Y%m%d') # Format: 20260625 + +VERSION_CLEAN="${BASE_VERSION}-nightly.${DATE}.${COMMIT_HASH}" +VERSION_TAG="v${VERSION_CLEAN}" + +echo "version_clean=$VERSION_CLEAN" >> $GITHUB_OUTPUT +echo "version_tag=$VERSION_TAG" >> $GITHUB_OUTPUT +echo "Generated version: $VERSION_CLEAN (Tag: $VERSION_TAG)" \ No newline at end of file diff --git a/.github/scripts/nightly/production_workflow.sh b/.github/scripts/nightly/production_workflow.sh new file mode 100644 index 00000000..09e3c39f --- /dev/null +++ b/.github/scripts/nightly/production_workflow.sh @@ -0,0 +1,11 @@ +TODAY=$(date -u +'%Y-%m-%d') + +RUNS=$(gh run list --workflow production.yml --limit 1 --json createdAt --jq '.[0].createdAt') + +if [[ "$RUNS" == "$TODAY"* ]]; then + echo "Production is underway today: $RUNS" + echo "should_skip=true" >> $GITHUB_OUTPUT +else + echo "Production has not started today." + echo "should_skip=false" >> $GITHUB_OUTPUT +fi \ No newline at end of file diff --git a/.github/scripts/nightly/update_files.sh b/.github/scripts/nightly/update_files.sh new file mode 100644 index 00000000..bd7a9d6c --- /dev/null +++ b/.github/scripts/nightly/update_files.sh @@ -0,0 +1,10 @@ +VERSION="${{ steps.versioning.outputs.version_clean }}" + +sed -i "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml + +if [ -f "package.json" ]; then + jq --arg ver "$VERSION" '.version = $ver' package.json > temp.json && mv temp.json package.json +fi + +rustup toolchain install stable --profile minimal +cargo update \ No newline at end of file diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index d6d1919b..cdd89299 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -20,45 +20,17 @@ jobs: id: check_prod env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - TODAY=$(date -u +'%Y-%m-%d') - - RUNS=$(gh run list --workflow production.yml --limit 1 --json createdAt --jq '.[0].createdAt') - - if [[ "$RUNS" == "$TODAY"* ]]; then - echo "Prod sudah jalan hari ini: $RUNS" - echo "should_skip=true" >> $GITHUB_OUTPUT - else - echo "Prod belum jalan hari ini." - echo "should_skip=false" >> $GITHUB_OUTPUT - fi + run: bash .github/scripts/nightly/production_workflow.sh - name: Stop if Prod already ran if: steps.check_prod.outputs.should_skip == 'true' run: | - echo "Prod sudah jalan, nightly cabut dulu ya. Bye!" + echo "Production is underway, so let's pull out the night shift first. Bye!" exit 0 - name: Filter Significant Changes id: filter_changes - run: | - PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") - - if [ -n "$PREV_TAG" ]; then - LOGS=$(git log $PREV_TAG..HEAD --pretty=format:"%s") - else - LOGS=$(git log --pretty=format:"%s") - fi - - HAS_SIGNIFICANT=$(echo "$LOGS" | grep -E "^(feat|fix)(\(.*\))?:" || echo "") - - if [ -n "$HAS_SIGNIFICANT" ]; then - echo "significant=true" >> $GITHUB_OUTPUT - echo "Ada perubahan signifikan, lanjut!" - else - echo "significant=false" >> $GITHUB_OUTPUT - echo "Gak ada feat/fix, skip build." - fi + run: bash .githuh/scripts/nightly/filter_significant.sh - name: Stop if not significant if: steps.filter_changes.outputs.significant == 'false' @@ -82,94 +54,19 @@ jobs: - name: Generate Nightly Version id: versioning if: steps.filter_changes.outputs.significant == 'true' - run: | - RAW_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0") - - CLEAN_VERSION=${RAW_TAG#v} - - BASE_VERSION=${CLEAN_VERSION%-nightly.*} - - COMMIT_HASH=$(git rev-parse --short HEAD) - DATE=$(date +'%Y%m%d') # Format: 20260625 - - VERSION_CLEAN="${BASE_VERSION}-nightly.${DATE}.${COMMIT_HASH}" - VERSION_TAG="v${VERSION_CLEAN}" - - echo "version_clean=$VERSION_CLEAN" >> $GITHUB_OUTPUT - echo "version_tag=$VERSION_TAG" >> $GITHUB_OUTPUT - echo "Generated version: $VERSION_CLEAN (Tag: $VERSION_TAG)" + run: bash .github/scripts/nightly/generate_version.sh - name: Update Files if: steps.filter_changes.outputs.significant == 'true' - run: | - VERSION="${{ steps.versioning.outputs.version_clean }}" - - sed -i "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml - - if [ -f "package.json" ]; then - jq --arg ver "$VERSION" '.version = $ver' package.json > temp.json && mv temp.json package.json - fi - - rustup toolchain install stable --profile minimal - cargo update + run: bash .github/scripts/nightly/update_files.sh - name: Commit and Push if: steps.filter_changes.outputs.significant == 'true' - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - - git add Cargo.toml - [ -f "package.json" ] && git add package.json - - if ! git diff --cached --quiet; then - git commit -m "chore: nightly release ${{ steps.versioning.outputs.version_clean }}" - git tag ${{ steps.versioning.outputs.version_tag }} - git push origin main --tags - else - echo "Gak ada perubahan file, skip push." - fi + run: bash .github/scripts/nightly/commit_push.sh - name: Create Release if: steps.filter_changes.outputs.significant == 'true' - run: | - PREV_TAG=$(git describe --tags --abbrev=0 --exclude="${{ steps.versioning.outputs.version_tag }}" 2>/dev/null || echo "") - - LOGS=$(git log $PREV_TAG..HEAD --pretty=format:"%s") - - FEAT=$(echo "$LOGS" | grep -E "^feat(\(.*\))?: " | sed -E 's/^feat(\(.*\))?: /- /' || echo "") - FIX=$(echo "$LOGS" | grep -E "^fix(\(.*\))?: " | sed -E 's/^fix(\(.*\))?: /- /' || echo "") - - COMPARE_LINK="https://github.com/${{ github.repository }}/compare/${PREV_TAG}...${{ steps.versioning.outputs.version_tag }}" - - { - echo "## What's Changed" - echo "Compare: $COMPARE_LINK" - echo "" - - if [ -n "$FEAT" ]; then - echo "### Features" - echo "$FEAT" - echo "" - fi - - if [ -n "$FIX" ]; then - echo "### Fixes" - echo "$FIX" - echo "" - fi - - if [ -z "$FEAT" ] && [ -z "$FIX" ]; then - echo "_No significant changes in this build._" - fi - - echo "***Nightly Owl has fallen out of bed tonight!***" - } > release_notes.md - - gh release create "${{ steps.versioning.outputs.version_tag }}" \ - --title "Nightly Build ${{ steps.versioning.outputs.version_tag }}" \ - --notes-file release_notes.md \ - --prerelease + run: bash .github/scripts/nightly/create_release.sh env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 2f1d53b63939aed9782c73b94036b1bfc7435416 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Fri, 3 Jul 2026 18:49:56 +0800 Subject: [PATCH 13/54] chore: Refactor checker ci --- .github/scripts/ci/deep_audit.sh | 20 ++++++++++++++++++++ .github/workflows/ci.yml | 22 +--------------------- 2 files changed, 21 insertions(+), 21 deletions(-) create mode 100644 .github/scripts/ci/deep_audit.sh diff --git a/.github/scripts/ci/deep_audit.sh b/.github/scripts/ci/deep_audit.sh new file mode 100644 index 00000000..fcc12d45 --- /dev/null +++ b/.github/scripts/ci/deep_audit.sh @@ -0,0 +1,20 @@ +FILES=$(find . -type d \( -name "target" -o -name "node_modules" -o -name "dist" -o -name "generated" \) -prune -o -type f \( -name "*.ts" -o -name "*.rs" \) -print) + +if [ -z "$FILES" ]; then + echo "There are no files to check." + exit 0 +fi + +MISSING_COPYRIGHT=$(echo "$FILES" | xargs grep -L "Copyright") +if [ -n "$MISSING_COPYRIGHT" ]; then + echo "This file needs a Copyright header:" + echo "$MISSING_COPYRIGHT" + exit 1 +fi + +JUNK_CHECK=$(echo "$FILES" | xargs awk 'NR==1 && /^\/\/ [A-Za-z0-9_-]+\.(ts|rs)$/ {print FILENAME}') +if [ -n "$JUNK_CHECK" ]; then + echo "The first line is just the file name (Junk):" + echo "$JUNK_CHECK" + exit 1 +fi \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9603beea..5b8d4782 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,27 +59,7 @@ jobs: cargo fmt --check - name: Deep Code Audit (Junk & Header) - run: | - FILES=$(find . -type d \( -name "target" -o -name "node_modules" -o -name "dist" -o -name "generated" \) -prune -o -type f \( -name "*.ts" -o -name "*.rs" \) -print) - - if [ -z "$FILES" ]; then - echo "There are no files to check." - exit 0 - fi - - MISSING_COPYRIGHT=$(echo "$FILES" | xargs grep -L "Copyright") - if [ -n "$MISSING_COPYRIGHT" ]; then - echo "This file needs a Copyright header:" - echo "$MISSING_COPYRIGHT" - exit 1 - fi - - JUNK_CHECK=$(echo "$FILES" | xargs awk 'NR==1 && /^\/\/ [A-Za-z0-9_-]+\.(ts|rs)$/ {print FILENAME}') - if [ -n "$JUNK_CHECK" ]; then - echo "The first line is just the file name (Junk):" - echo "$JUNK_CHECK" - exit 1 - fi + run: bash .github/scripts/nightly/deep_audit.sh - name: Rust Security & Quality (Clippy) run: cargo clippy -- -D warnings From 00a4ff5d44b239863eef2fa90ea11040f566ff5b Mon Sep 17 00:00:00 2001 From: Claycuy Date: Sat, 4 Jul 2026 17:44:45 +0800 Subject: [PATCH 14/54] chore: Refactor publish ci --- .github/scripts/publish/build_release.sh | 15 ++ .github/scripts/publish/publish_crates.sh | 5 + .github/scripts/publish/publish_npm.sh | 132 +++++++++++ .github/scripts/publish/setup_ndk.sh | 18 ++ .../scripts/publish/sync_assets_version.sh | 13 ++ .github/workflows/publish.yml | 210 +----------------- 6 files changed, 188 insertions(+), 205 deletions(-) create mode 100644 .github/scripts/publish/build_release.sh create mode 100644 .github/scripts/publish/publish_crates.sh create mode 100644 .github/scripts/publish/publish_npm.sh create mode 100644 .github/scripts/publish/setup_ndk.sh create mode 100644 .github/scripts/publish/sync_assets_version.sh diff --git a/.github/scripts/publish/build_release.sh b/.github/scripts/publish/build_release.sh new file mode 100644 index 00000000..0b6ec62e --- /dev/null +++ b/.github/scripts/publish/build_release.sh @@ -0,0 +1,15 @@ +if [[ "${{ matrix.platform }}" == *"android"* ]]; then + cargo build --release --target ${{ matrix.target }} +elif [[ "${{ matrix.platform }}" == *"musl"* ]]; then + if [ ! -f "./cross" ]; then + curl -L https://github.com/cross-rs/cross/releases/latest/download/cross-x86_64-unknown-linux-musl.tar.gz | tar xz + chmod +x cross + fi + RUSTFLAGS="-C target-feature=-crt-static" ./cross build --release --target ${{ matrix.target }} +else + if [ ! -f "./cross" ]; then + curl -L https://github.com/cross-rs/cross/releases/latest/download/cross-x86_64-unknown-linux-musl.tar.gz | tar xz + chmod +x cross + fi + ./cross build --release --target ${{ matrix.target }} +fi diff --git a/.github/scripts/publish/publish_crates.sh b/.github/scripts/publish/publish_crates.sh new file mode 100644 index 00000000..2154c68d --- /dev/null +++ b/.github/scripts/publish/publish_crates.sh @@ -0,0 +1,5 @@ +if [[ "${{ github.event.inputs.version_override }}" == *"nightly"* ]]; then + cargo publish --token ${{ secrets.CRATES_IO_TOKEN }} --allow-dirty --no-verify +else + cargo publish --token ${{ secrets.CRATES_IO_TOKEN }} --allow-dirty +fi \ No newline at end of file diff --git a/.github/scripts/publish/publish_npm.sh b/.github/scripts/publish/publish_npm.sh new file mode 100644 index 00000000..9220ee65 --- /dev/null +++ b/.github/scripts/publish/publish_npm.sh @@ -0,0 +1,132 @@ +VERSION="${{ github.event.inputs.version_override }}" +if [ -z "$VERSION" ]; then + RAW_VERSION="${{ github.event.release.tag_name }}" + VERSION=${RAW_VERSION#v} +fi + +if [ -z "$VERSION" ]; then + echo "Fetch latest release tag from GitHub API..." + LATEST_TAG=$(gh release view --json tagName --template '{{.tagName}}' 2>/dev/null || echo "") + if [ -n "$LATEST_TAG" ]; then + VERSION=${LATEST_TAG#v} + echo "Successfully resolved latest release version: $VERSION" + else + echo "No release found via API. Falling back to Cargo.toml..." + VERSION=$(grep '^version =' Cargo.toml | head -n1 | cut -d '"' -f2) + fi +fi + +echo "Final Publishing Version: $VERSION" + +TAG="latest" +if [[ "$VERSION" =~ -(proto|alpha|beta|rc) ]]; then TAG="next"; fi +echo "Using NPM Tag: $TAG" + +PLATFORMS=( + "binary-linux-x64|linux-x64|index.linux.node|x64" + "binary-linux-arm64|linux-arm64|index.linux-arm64.node|arm64" + "binary-linux-ia32|linux-ia32|index.linux32.node|ia32" + "binary-win32-x64|win32-x64|index.win.node|x64" + "binary-win32-ia32|win32-ia32|index.win32.node|ia32" + "binary-darwin-x64|darwin-x64|index.darwin.node|x64" + "binary-android-arm64|android-arm64|index.android.node|arm64" + "binary-android-arm|android-arm|index.android32.node|arm" + "binary-linux-musl-x64|linux-musl-x64|index.musl-x64.node|x64" + "binary-linux-musl-arm64|linux-musl-arm64|index.musl-arm64.node|arm64" + "binary-linux-musl-ia32|linux-musl-ia32|index.musl-ia32.node|ia32" + "binary-freebsd-x64|freebsd-x64|index.freebsd.node|x64" + "binary-browser-wasm|browser-wasm|index.wasm|wasm" +) + +sudo apt-get install -y jq + +for item in "${PLATFORMS[@]}"; do + IFS="|" read -r ARTIFACT PLATFORM BIN_NAME CPU <<< "$item" + PKG_NAME="@lightvm/core-$PLATFORM" + OS_VAL="${PLATFORM%-*}" + mkdir -p "publish/$PLATFORM" + + if [[ "$PLATFORM" == "browser-wasm" ]]; then + echo "=== Isi dari binaries/$ARTIFACT ===" + ls -la "binaries/$ARTIFACT" + + cp -r "binaries/$ARTIFACT"/. "publish/$PLATFORM/" + + cd "publish/$PLATFORM" + + WASM_JS_FILE=$(find . -maxdepth 1 -name "*.js" ! -name "index.js" | head -n 1) + if [ -n "$WASM_JS_FILE" ]; then + mv "$WASM_JS_FILE" "index.js" + fi + + WASM_BG_FILE=$(find . -maxdepth 1 -name "*_bg.wasm" | head -n 1) + if [ -n "$WASM_BG_FILE" ]; then + mv "$WASM_BG_FILE" "index.wasm" + fi + + cd ../.. + + MAIN_FIELD="index.js" + FILES_FIELD=$(jq -nc '["index.wasm", "index.js", "*.d.ts", "README.md", "LICENSE"]') + else + find "binaries/$ARTIFACT" -type f \( -name "*.node" -o -name "*.dll" -o -name "*.so" -o -name "*.dylib" \) -exec cp {} "publish/$PLATFORM/$BIN_NAME" \; + MAIN_FIELD="$BIN_NAME" + FILES_FIELD=$(jq -nc --arg bin "$BIN_NAME" '[$bin, "README.md", "LICENSE"]') + fi + + cp -f README.md "publish/$PLATFORM/" || true + cp -f LICENSE "publish/$PLATFORM/" || true + + jq -n \ + --arg name "$PKG_NAME" \ + --arg ver "$VERSION" \ + --arg os "$OS_VAL" \ + --arg cpu "$CPU" \ + --arg main "$MAIN_FIELD" \ + --argjson files "$FILES_FIELD" \ + '{ + name: $name, + version: $ver, + os: [$os], + cpu: [$cpu], + main: $main, + files: $files, + publishConfig: { access: "public" }, + license: "Apache-2.0" + }' > "publish/$PLATFORM/package.json" + + cd "publish/$PLATFORM" + + if [[ "${{ github.event_name }}" == "release" ]] || [[ "${{ github.event_name }}" == "workflow_dispatch" && "$VERSION" == *"nightly"* ]]; then + echo "Event Rilisan/Nightly Terdeteksi: Menjalankan Real Publish ke NPM..." + npm publish --tag $TAG --access public || echo "Skip existing" + else + echo "Event Manual (Non-Nightly) Terdeteksi: Menjalankan Dry-Run (NPM Pack)..." + npm pack + mkdir -p ../../dist-test + mv *.tgz ../../dist-test/ + fi + + cd ../.. +done + +if [[ "${{ github.event_name }}" == "release" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then + jq --arg ver "$VERSION" \ + '.version = $ver | .optionalDependencies = { + "@lightvm/core-linux-x64": $ver, + "@lightvm/core-linux-arm64": $ver, + "@lightvm/core-linux-ia32": $ver, + "@lightvm/core-win32-x64": $ver, + "@lightvm/core-win32-ia32": $ver, + "@lightvm/core-darwin-x64": $ver, + "@lightvm/core-android-arm64": $ver, + "@lightvm/core-android-arm": $ver, + "@lightvm/core-linux-musl-x64": $ver, + "@lightvm/core-linux-musl-arm64": $ver, + "@lightvm/core-linux-musl-ia32": $ver, + "@lightvm/core-freebsd-x64": $ver, + "@lightvm/core-browser-wasm": $ver + }' package.json > temp.json && mv temp.json package.json + + npm publish --access public --tag $TAG +fi \ No newline at end of file diff --git a/.github/scripts/publish/setup_ndk.sh b/.github/scripts/publish/setup_ndk.sh new file mode 100644 index 00000000..eb7a857c --- /dev/null +++ b/.github/scripts/publish/setup_ndk.sh @@ -0,0 +1,18 @@ +echo "ANDROID_NDK_HOME=$ANDROID_NDK_LATEST_HOME" >> $GITHUB_ENV + +TOOLCHAIN="$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin" + +mkdir -p .cargo +if [ "${{ matrix.platform }}" == "android-arm64" ]; then + LINKER="aarch64-linux-android33-clang" + echo "CC=$TOOLCHAIN/aarch64-linux-android33-clang" >> $GITHUB_ENV +else + LINKER="armv7a-linux-androideabi33-clang" + echo "CC=$TOOLCHAIN/armv7a-linux-androideabi33-clang" >> $GITHUB_ENV +fi + +echo "AR=$TOOLCHAIN/llvm-ar" >> $GITHUB_ENV + +echo "[target.${{ matrix.target }}]" > .cargo/config.toml +echo "ar = \"$TOOLCHAIN/llvm-ar\"" >> .cargo/config.toml +echo "linker = \"$TOOLCHAIN/$LINKER\"" >> .cargo/config.toml diff --git a/.github/scripts/publish/sync_assets_version.sh b/.github/scripts/publish/sync_assets_version.sh new file mode 100644 index 00000000..02c27a2b --- /dev/null +++ b/.github/scripts/publish/sync_assets_version.sh @@ -0,0 +1,13 @@ +VERSION="${{ github.event.inputs.version_override }}" + +if [ -z "$VERSION" ]; then + RAW_VERSION="${{ github.event.release.tag_name }}" + VERSION=${RAW_VERSION#v} +fi + +if [ -z "$VERSION" ]; then + VERSION=$(grep '^version =' Cargo.toml | head -n1 | cut -d '"' -f2) +fi + +echo "Publishing version: $VERSION" +sed -i "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1dd0febd..027bb483 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -103,26 +103,7 @@ jobs: - name: Setup Android NDK if: contains(matrix.platform, 'android') - run: | - echo "ANDROID_NDK_HOME=$ANDROID_NDK_LATEST_HOME" >> $GITHUB_ENV - - TOOLCHAIN="$ANDROID_NDK_LATEST_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin" - - mkdir -p .cargo - if [ "${{ matrix.platform }}" == "android-arm64" ]; then - LINKER="aarch64-linux-android33-clang" - echo "CC=$TOOLCHAIN/aarch64-linux-android33-clang" >> $GITHUB_ENV - else - LINKER="armv7a-linux-androideabi33-clang" - echo "CC=$TOOLCHAIN/armv7a-linux-androideabi33-clang" >> $GITHUB_ENV - fi - - echo "AR=$TOOLCHAIN/llvm-ar" >> $GITHUB_ENV - - echo "[target.${{ matrix.target }}]" > .cargo/config.toml - echo "ar = \"$TOOLCHAIN/llvm-ar\"" >> .cargo/config.toml - echo "linker = \"$TOOLCHAIN/$LINKER\"" >> .cargo/config.toml - + run: bash .github/scripts/publish/setup_ndk.sh - name: Build Release (Standard) if: | matrix.platform == 'linux-x64' || @@ -138,23 +119,7 @@ jobs: contains(matrix.platform, 'musl') || contains(matrix.platform, 'arm64') || matrix.platform == 'linux-ia32' - run: | - if [[ "${{ matrix.platform }}" == *"android"* ]]; then - cargo build --release --target ${{ matrix.target }} - elif [[ "${{ matrix.platform }}" == *"musl"* ]]; then - if [ ! -f "./cross" ]; then - curl -L https://github.com/cross-rs/cross/releases/latest/download/cross-x86_64-unknown-linux-musl.tar.gz | tar xz - chmod +x cross - fi - RUSTFLAGS="-C target-feature=-crt-static" ./cross build --release --target ${{ matrix.target }} - else - if [ ! -f "./cross" ]; then - curl -L https://github.com/cross-rs/cross/releases/latest/download/cross-x86_64-unknown-linux-musl.tar.gz | tar xz - chmod +x cross - fi - ./cross build --release --target ${{ matrix.target }} - fi - + run: bash .github/scripts/publish/build_release.sh - name: Build WASM if: matrix.platform == 'browser-wasm' run: | @@ -209,148 +174,7 @@ jobs: npm run build - name: Publish to NPM - run: | - VERSION="${{ github.event.inputs.version_override }}" - if [ -z "$VERSION" ]; then - RAW_VERSION="${{ github.event.release.tag_name }}" - VERSION=${RAW_VERSION#v} - fi - - if [ -z "$VERSION" ]; then - echo "Fetch latest release tag from GitHub API..." - LATEST_TAG=$(gh release view --json tagName --template '{{.tagName}}' 2>/dev/null || echo "") - if [ -n "$LATEST_TAG" ]; then - VERSION=${LATEST_TAG#v} - echo "Successfully resolved latest release version: $VERSION" - else - echo "No release found via API. Falling back to Cargo.toml..." - VERSION=$(grep '^version =' Cargo.toml | head -n1 | cut -d '"' -f2) - fi - fi - - echo "Final Publishing Version: $VERSION" - - TAG="latest" - if [[ "$VERSION" =~ -(proto|alpha|beta|rc) ]]; then TAG="next"; fi - echo "Using NPM Tag: $TAG" - - PLATFORMS=( - "binary-linux-x64|linux-x64|index.linux.node|x64" - "binary-linux-arm64|linux-arm64|index.linux-arm64.node|arm64" - "binary-linux-ia32|linux-ia32|index.linux32.node|ia32" - "binary-win32-x64|win32-x64|index.win.node|x64" - "binary-win32-ia32|win32-ia32|index.win32.node|ia32" - "binary-darwin-x64|darwin-x64|index.darwin.node|x64" - "binary-android-arm64|android-arm64|index.android.node|arm64" - "binary-android-arm|android-arm|index.android32.node|arm" - "binary-linux-musl-x64|linux-musl-x64|index.musl-x64.node|x64" - "binary-linux-musl-arm64|linux-musl-arm64|index.musl-arm64.node|arm64" - "binary-linux-musl-ia32|linux-musl-ia32|index.musl-ia32.node|ia32" - "binary-freebsd-x64|freebsd-x64|index.freebsd.node|x64" - "binary-browser-wasm|browser-wasm|index.wasm|wasm" - ) - - sudo apt-get install -y jq - - for item in "${PLATFORMS[@]}"; do - IFS="|" read -r ARTIFACT PLATFORM BIN_NAME CPU <<< "$item" - PKG_NAME="@lightvm/core-$PLATFORM" - OS_VAL="${PLATFORM%-*}" - mkdir -p "publish/$PLATFORM" - - if [[ "$PLATFORM" == "browser-wasm" ]]; then - # Intip dulu isinya buat memastikan filenya ada lewat logs - echo "=== Isi dari binaries/$ARTIFACT ===" - ls -la "binaries/$ARTIFACT" - - # Copy semua isi artifact (termasuk .wasm, .js, .d.ts) - cp -r "binaries/$ARTIFACT"/. "publish/$PLATFORM/" - - # Rename file hasil wasm-pack biar sinkron jadi index.js & index.wasm - cd "publish/$PLATFORM" - - # Cari file .js bawaan wasm-pack dan rename ke index.js - WASM_JS_FILE=$(find . -maxdepth 1 -name "*.js" ! -name "index.js" | head -n 1) - if [ -n "$WASM_JS_FILE" ]; then - mv "$WASM_JS_FILE" "index.js" - fi - - # Cari file _bg.wasm bawaan wasm-pack dan rename ke index.wasm - WASM_BG_FILE=$(find . -maxdepth 1 -name "*_bg.wasm" | head -n 1) - if [ -n "$WASM_BG_FILE" ]; then - mv "$WASM_BG_FILE" "index.wasm" - fi - - # Balik ke root directory sebelum lanjutin proses jq dan npm publish - cd ../.. - - MAIN_FIELD="index.js" - FILES_FIELD=$(jq -nc '["index.wasm", "index.js", "*.d.ts", "README.md", "LICENSE"]') - else - find "binaries/$ARTIFACT" -type f \( -name "*.node" -o -name "*.dll" -o -name "*.so" -o -name "*.dylib" \) -exec cp {} "publish/$PLATFORM/$BIN_NAME" \; - MAIN_FIELD="$BIN_NAME" - FILES_FIELD=$(jq -nc --arg bin "$BIN_NAME" '[$bin, "README.md", "LICENSE"]') - fi - - cp -f README.md "publish/$PLATFORM/" || true - cp -f LICENSE "publish/$PLATFORM/" || true - - jq -n \ - --arg name "$PKG_NAME" \ - --arg ver "$VERSION" \ - --arg os "$OS_VAL" \ - --arg cpu "$CPU" \ - --arg main "$MAIN_FIELD" \ - --argjson files "$FILES_FIELD" \ - '{ - name: $name, - version: $ver, - os: [$os], - cpu: [$cpu], - main: $main, - files: $files, - publishConfig: { access: "public" }, - license: "Apache-2.0" - }' > "publish/$PLATFORM/package.json" - - cd "publish/$PLATFORM" - - # --- VALIDASI OTOMATIS BERDASARKAN EVENT TYPE --- - # Kita tetap publish jika eventnya adalah 'release' - # ATAU jika 'workflow_dispatch' dan version-nya mengandung 'nightly' (biar nightly tetep publish) - if [[ "${{ github.event_name }}" == "release" ]] || [[ "${{ github.event_name }}" == "workflow_dispatch" && "$VERSION" == *"nightly"* ]]; then - echo "Event Rilisan/Nightly Terdeteksi: Menjalankan Real Publish ke NPM..." - npm publish --tag $TAG --access public || echo "Skip existing" - else - echo "Event Manual (Non-Nightly) Terdeteksi: Menjalankan Dry-Run (NPM Pack)..." - npm pack - mkdir -p ../../dist-test - mv *.tgz ../../dist-test/ - fi - - cd ../.. - done - - if [[ "${{ github.event_name }}" == "release" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then - jq --arg ver "$VERSION" \ - '.version = $ver | .optionalDependencies = { - "@lightvm/core-linux-x64": $ver, - "@lightvm/core-linux-arm64": $ver, - "@lightvm/core-linux-ia32": $ver, - "@lightvm/core-win32-x64": $ver, - "@lightvm/core-win32-ia32": $ver, - "@lightvm/core-darwin-x64": $ver, - "@lightvm/core-android-arm64": $ver, - "@lightvm/core-android-arm": $ver, - "@lightvm/core-linux-musl-x64": $ver, - "@lightvm/core-linux-musl-arm64": $ver, - "@lightvm/core-linux-musl-ia32": $ver, - "@lightvm/core-freebsd-x64": $ver, - "@lightvm/core-browser-wasm": $ver - }' package.json > temp.json && mv temp.json package.json - - npm publish --access public --tag $TAG - fi + run: bash .github/scripts/publish/publish_npm.sh env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} @@ -364,7 +188,6 @@ jobs: publish-crates: needs: build-npm - # Ubah 'if' nya biar mau jalan pas workflow_dispatch juga if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest steps: @@ -374,30 +197,7 @@ jobs: uses: dtolnay/rust-toolchain@stable - name: Sync Assets and Version - run: | - # 1. Coba ambil dari input override dulu - VERSION="${{ github.event.inputs.version_override }}" - - # 2. Kalau kosong, ambil dari tag release - if [ -z "$VERSION" ]; then - RAW_VERSION="${{ github.event.release.tag_name }}" - VERSION=${RAW_VERSION#v} - fi - - # 3. Kalau masih kosong juga, ambil dari Cargo.toml (fallback) - if [ -z "$VERSION" ]; then - VERSION=$(grep '^version =' Cargo.toml | head -n1 | cut -d '"' -f2) - fi - - echo "Publishing version: $VERSION" - sed -i "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml + run: bash .github/scripts/publish/sync_assets_version.sh - name: Publish to Crates.io - run: | - # Kalau nightly (biasanya mengandung 'nightly'), kita perlu --allow-dirty - # dan mungkin perlu --no-verify kalau tes-nya gagal karena biner belum ada di crates - if [[ "${{ github.event.inputs.version_override }}" == *"nightly"* ]]; then - cargo publish --token ${{ secrets.CRATES_IO_TOKEN }} --allow-dirty --no-verify - else - cargo publish --token ${{ secrets.CRATES_IO_TOKEN }} --allow-dirty - fi + run: bash .github/scripts/publish/publish_crates.sh From 4c1af00a4a2d6a4c00068ca82011caabf5711872 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Sat, 4 Jul 2026 17:47:35 +0800 Subject: [PATCH 15/54] fix(ci): Ci quality gate path --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5b8d4782..6c81de1b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,7 +59,7 @@ jobs: cargo fmt --check - name: Deep Code Audit (Junk & Header) - run: bash .github/scripts/nightly/deep_audit.sh + run: bash .github/scripts/ci/deep_audit.sh - name: Rust Security & Quality (Clippy) run: cargo clippy -- -D warnings From 9855bc8b249e375ce877fd8d686125f1bea648b5 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Sat, 4 Jul 2026 18:25:31 +0800 Subject: [PATCH 16/54] chore: Refactor production ci --- .github/scripts/production/create_release.sh | 10 ++++ .../production/generate_release_notes.sh | 22 +++++++++ .../production/validate_version_tag.sh | 11 +++++ .github/workflows/production.yml | 49 ++----------------- 4 files changed, 46 insertions(+), 46 deletions(-) create mode 100644 .github/scripts/production/create_release.sh create mode 100644 .github/scripts/production/generate_release_notes.sh create mode 100644 .github/scripts/production/validate_version_tag.sh diff --git a/.github/scripts/production/create_release.sh b/.github/scripts/production/create_release.sh new file mode 100644 index 00000000..1b6fa328 --- /dev/null +++ b/.github/scripts/production/create_release.sh @@ -0,0 +1,10 @@ +VERSION="${{ github.event.inputs.version }}" +git config user.name "github-actions[bot]" +git config user.email "github-actions[bot]@users.noreply.github.com" + +git tag "v$VERSION" +git push origin "v$VERSION" + +gh release create "v$VERSION" \ + --title "Release $VERSION" \ + --notes-file release_notes.md \ No newline at end of file diff --git a/.github/scripts/production/generate_release_notes.sh b/.github/scripts/production/generate_release_notes.sh new file mode 100644 index 00000000..15b49f53 --- /dev/null +++ b/.github/scripts/production/generate_release_notes.sh @@ -0,0 +1,22 @@ +VERSION="${{ github.event.inputs.version }}" + +LAST_STABLE=$(git tag --sort=-creatordate | grep -v "nightly" | head -n 1 || echo "") + +NIGHTLIES=$(git tag | grep "nightly" | sort -V) + +if [ -n "$LAST_STABLE" ]; then + FINAL_NIGHTLIES=$(echo "$NIGHTLIES" | awk -v last="$LAST_STABLE" '$0 > last') +else + FINAL_NIGHTLIES="$NIGHTLIES" +fi + +{ + echo "Release based on Changelogs:" + if [ -n "$FINAL_NIGHTLIES" ]; then + echo "$FINAL_NIGHTLIES" | sed 's/^/* /' + else + echo "* No previous nightly builds." + fi + echo "" + echo "***Lion Owl caught in apple net!***" +} > release_notes.md \ No newline at end of file diff --git a/.github/scripts/production/validate_version_tag.sh b/.github/scripts/production/validate_version_tag.sh new file mode 100644 index 00000000..6582ad94 --- /dev/null +++ b/.github/scripts/production/validate_version_tag.sh @@ -0,0 +1,11 @@ +VERSION="${{ github.event.inputs.version }}" +if git rev-parse "v$VERSION" >/dev/null 2>&1; then + echo "Error: Versi $VERSION sudah ada tag-nya! Ganti versi dulu." + exit 1 +fi + +FILE_VERSION=$(jq -r .version package.json) +if [ "$FILE_VERSION" != "$VERSION" ]; then + echo "Error: Versi di package.json ($FILE_VERSION) tidak sama dengan input ($VERSION)." + exit 1 +fi \ No newline at end of file diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml index 90b1bbf4..d44083c6 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/production.yml @@ -19,56 +19,13 @@ jobs: fetch-depth: 0 - name: Validate Version & Check Tag - run: | - VERSION="${{ github.event.inputs.version }}" - if git rev-parse "v$VERSION" >/dev/null 2>&1; then - echo "Error: Versi $VERSION sudah ada tag-nya! Ganti versi dulu." - exit 1 - fi - - FILE_VERSION=$(jq -r .version package.json) - if [ "$FILE_VERSION" != "$VERSION" ]; then - echo "Error: Versi di package.json ($FILE_VERSION) tidak sama dengan input ($VERSION)." - exit 1 - fi + run: bash .github/scripts/production/validate_version_tag.sh - name: Generate Release Notes - run: | - VERSION="${{ github.event.inputs.version }}" - - LAST_STABLE=$(git tag --sort=-creatordate | grep -v "nightly" | head -n 1 || echo "") - - NIGHTLIES=$(git tag | grep "nightly" | sort -V) - - if [ -n "$LAST_STABLE" ]; then - FINAL_NIGHTLIES=$(echo "$NIGHTLIES" | awk -v last="$LAST_STABLE" '$0 > last') - else - FINAL_NIGHTLIES="$NIGHTLIES" - fi - - { - echo "Release based on Changelogs:" - if [ -n "$FINAL_NIGHTLIES" ]; then - echo "$FINAL_NIGHTLIES" | sed 's/^/* /' - else - echo "* No previous nightly builds." - fi - echo "" - echo "***Lion Owl caught in apple net!***" - } > release_notes.md + run: bash .github/scripts/production/generate_release_notes.sh - name: Create Release - run: | - VERSION="${{ github.event.inputs.version }}" - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - - git tag "v$VERSION" - git push origin "v$VERSION" - - gh release create "v$VERSION" \ - --title "Release $VERSION" \ - --notes-file release_notes.md + run: bash .github/scripts/production/create_release.sh env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 2b8b3a5daee063b061356c440839fbdb80d29660 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Sat, 4 Jul 2026 18:31:44 +0800 Subject: [PATCH 17/54] chore: Refactor check tokens ci --- .github/scripts/tokens/check_crates_token.sh | 9 ++++ .github/scripts/tokens/check_npm_token.sh | 8 ++++ .github/scripts/tokens/create_issue.sh | 22 ++++++++++ .github/workflows/check-tokens.yml | 46 ++------------------ 4 files changed, 42 insertions(+), 43 deletions(-) create mode 100644 .github/scripts/tokens/check_crates_token.sh create mode 100644 .github/scripts/tokens/check_npm_token.sh create mode 100644 .github/scripts/tokens/create_issue.sh diff --git a/.github/scripts/tokens/check_crates_token.sh b/.github/scripts/tokens/check_crates_token.sh new file mode 100644 index 00000000..73ee24fe --- /dev/null +++ b/.github/scripts/tokens/check_crates_token.sh @@ -0,0 +1,9 @@ +echo "Checking Crates.io token using Cargo CLI..." + +if cargo owner --list lightvm --token "$CRATES_TOKEN" > /dev/null 2>&1; then + echo "code=200" >> $GITHUB_OUTPUT + echo "status=valid" >> $GITHUB_OUTPUT +else + echo "code=401" >> $GITHUB_OUTPUT + echo "status=invalid" >> $GITHUB_OUTPUT +fi \ No newline at end of file diff --git a/.github/scripts/tokens/check_npm_token.sh b/.github/scripts/tokens/check_npm_token.sh new file mode 100644 index 00000000..56c4e5a6 --- /dev/null +++ b/.github/scripts/tokens/check_npm_token.sh @@ -0,0 +1,8 @@ +echo "Checking NPM token..." +RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: Bearer $NPM_TOKEN" https://registry.npmjs.org/-/whoami) +echo "code=$RESPONSE" >> $GITHUB_OUTPUT +if [ "$RESPONSE" -eq 200 ]; then + echo "status=valid" >> $GITHUB_OUTPUT +else + echo "status=invalid" >> $GITHUB_OUTPUT +fi \ No newline at end of file diff --git a/.github/scripts/tokens/create_issue.sh b/.github/scripts/tokens/create_issue.sh new file mode 100644 index 00000000..54fa4961 --- /dev/null +++ b/.github/scripts/tokens/create_issue.sh @@ -0,0 +1,22 @@ +const npmValid = "${{ steps.check_npm.outputs.status }}" === "valid"; +const cratesValid = "${{ steps.check_crates.outputs.status }}" === "valid"; + +const npmCode = "${{ steps.check_npm.outputs.code }}"; +const cratesCode = "${{ steps.check_crates.outputs.code }}"; + +const npmStatus = npmValid ? "✅ VALID" : `❌ EXPIRED/INVALID (HTTP ${npmCode})`; +const cratesStatus = cratesValid ? "✅ VALID" : `❌ EXPIRED/INVALID (HTTP ${cratesCode})`; + +await github.rest.issues.create({ + owner: context.repo.owner, + repo: context.repo.repo, + title: "⚠️ ALERT: GitHub Token Registry Expired!", + assignees: ["claycuy"], + labels: ["bug", "security"], + body: `Hi, Maintainer. One of your tokens is no longer valid: + +- NPM Token: ${npmStatus} +- Crates.io Token: ${cratesStatus} + +Hurry up and change it in the repo settings!` +}); \ No newline at end of file diff --git a/.github/workflows/check-tokens.yml b/.github/workflows/check-tokens.yml index 0e767510..57a23ca6 100644 --- a/.github/workflows/check-tokens.yml +++ b/.github/workflows/check-tokens.yml @@ -21,15 +21,7 @@ jobs: continue-on-error: true env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - run: | - echo "Checking NPM token..." - RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: Bearer $NPM_TOKEN" https://registry.npmjs.org/-/whoami) - echo "code=$RESPONSE" >> $GITHUB_OUTPUT - if [ "$RESPONSE" -eq 200 ]; then - echo "status=valid" >> $GITHUB_OUTPUT - else - echo "status=invalid" >> $GITHUB_OUTPUT - fi + run: bash .github/scripts/tokens/check_npm_token.sh # Kita install Rust Toolchain dulu khusus buat runner ini - name: Install Rust CLI @@ -40,45 +32,13 @@ jobs: continue-on-error: true env: CRATES_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} - run: | - echo "Checking Crates.io token using Cargo CLI..." - - # Kita tes minta daftar owner crate 'lightvm' pake token lu - if cargo owner --list lightvm --token "$CRATES_TOKEN" > /dev/null 2>&1; then - echo "code=200" >> $GITHUB_OUTPUT - echo "status=valid" >> $GITHUB_OUTPUT - else - echo "code=401" >> $GITHUB_OUTPUT - echo "status=invalid" >> $GITHUB_OUTPUT - fi + run: bash .github/scripts/tokens/check_crates_token.sh - name: Create Issue on Token Expiration if: steps.check_npm.outputs.status != 'valid' || steps.check_crates.outputs.status != 'valid' uses: actions/github-script@v7 with: - script: | - const npmValid = "${{ steps.check_npm.outputs.status }}" === "valid"; - const cratesValid = "${{ steps.check_crates.outputs.status }}" === "valid"; - - const npmCode = "${{ steps.check_npm.outputs.code }}"; - const cratesCode = "${{ steps.check_crates.outputs.code }}"; - - const npmStatus = npmValid ? "✅ VALID" : `❌ EXPIRED/INVALID (HTTP ${npmCode})`; - const cratesStatus = cratesValid ? "✅ VALID" : `❌ EXPIRED/INVALID (HTTP ${cratesCode})`; - - await github.rest.issues.create({ - owner: context.repo.owner, - repo: context.repo.repo, - title: "⚠️ ALERT: GitHub Token Registry Expired!", - assignees: ["claycuy"], - labels: ["bug", "security"], - body: `Hi, Maintainer. One of your tokens is no longer valid: - - - NPM Token: ${npmStatus} - - Crates.io Token: ${cratesStatus} - - Hurry up and change it in the repo settings!` - }); + script: bash .github/scripts/tokens/create_issue.sh - name: Force Workflow Failure if: steps.check_npm.outputs.status != 'valid' || steps.check_crates.outputs.status != 'valid' From 2f04c2dd8e7ffce056d22fabfe58523909fcf9a5 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Sat, 4 Jul 2026 18:56:06 +0800 Subject: [PATCH 18/54] chore: Refactor stats ci --- .github/scripts/stats/fetch_update_gist.sh | 14 ++++++++++++++ .github/workflows/stats.yml | 16 +--------------- 2 files changed, 15 insertions(+), 15 deletions(-) create mode 100644 .github/scripts/stats/fetch_update_gist.sh diff --git a/.github/scripts/stats/fetch_update_gist.sh b/.github/scripts/stats/fetch_update_gist.sh new file mode 100644 index 00000000..71a56710 --- /dev/null +++ b/.github/scripts/stats/fetch_update_gist.sh @@ -0,0 +1,14 @@ +CLONES=$(curl -s -H "Authorization: token ${{ secrets.LIGHTVM_PAT }}" \ +"https://api.github.com/repos/${{ github.repository }}/traffic/clones" \ +| jq '.count // 0') + +TRAFFIC_DATA=$(curl -s -H "Authorization: token ${{ secrets.LIGHTVM_PAT }}" \ +"https://api.github.com/repos/${{ github.repository }}/traffic/views") + +TOTAL_VIEWS=$(echo $TRAFFIC_DATA | jq '.count // 0') +UNIQUE_VISITORS=$(echo $TRAFFIC_DATA | jq '.uniques // 0') + +curl -s -X PATCH -H "Authorization: token ${{ secrets.LIGHTVM_PAT }}" \ +-H "Content-Type: application/json" \ +-d "{\"files\":{\"stats.json\":{\"content\":\"{\\\"clones\\\": $CLONES, \\\"total_views\\\": $TOTAL_VIEWS, \\\"unique_visitors\\\": $UNIQUE_VISITORS}\"}}}" \ +"https://api.github.com/gists/${{ secrets.GIST_ID }}" \ No newline at end of file diff --git a/.github/workflows/stats.yml b/.github/workflows/stats.yml index 0fa20c0f..7af773d5 100644 --- a/.github/workflows/stats.yml +++ b/.github/workflows/stats.yml @@ -14,18 +14,4 @@ jobs: runs-on: ubuntu-latest steps: - name: Fetch and Update Gist - run: | - CLONES=$(curl -s -H "Authorization: token ${{ secrets.LIGHTVM_PAT }}" \ - "https://api.github.com/repos/${{ github.repository }}/traffic/clones" \ - | jq '.count // 0') - - TRAFFIC_DATA=$(curl -s -H "Authorization: token ${{ secrets.LIGHTVM_PAT }}" \ - "https://api.github.com/repos/${{ github.repository }}/traffic/views") - - TOTAL_VIEWS=$(echo $TRAFFIC_DATA | jq '.count // 0') - UNIQUE_VISITORS=$(echo $TRAFFIC_DATA | jq '.uniques // 0') - - curl -s -X PATCH -H "Authorization: token ${{ secrets.LIGHTVM_PAT }}" \ - -H "Content-Type: application/json" \ - -d "{\"files\":{\"stats.json\":{\"content\":\"{\\\"clones\\\": $CLONES, \\\"total_views\\\": $TOTAL_VIEWS, \\\"unique_visitors\\\": $UNIQUE_VISITORS}\"}}}" \ - "https://api.github.com/gists/${{ secrets.GIST_ID }}" + run: bash .github/scripts/stats/fetch_update_gish.sh From 6b324b4c211857da4b7845b2f134972a47dbf8d6 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Sat, 4 Jul 2026 20:29:11 +0800 Subject: [PATCH 19/54] chore: Added sync-deps.yml --- .github/workflows/sync-deps.yml | 44 +++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/sync-deps.yml diff --git a/.github/workflows/sync-deps.yml b/.github/workflows/sync-deps.yml new file mode 100644 index 00000000..be2fa5fa --- /dev/null +++ b/.github/workflows/sync-deps.yml @@ -0,0 +1,44 @@ +name: Sync Lock Files + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + sync: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + + # Sinkronisasi NPM + - name: Sync package-lock.json + run: | + npm install --package-lock-only + + # Sinkronisasi Cargo + - name: Sync Cargo.lock + run: | + cargo generate-lockfile + + # Commit kalau ada perubahan (opsional) + - name: Commit changes + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git add package-lock.json Cargo.lock + if ! git diff --cached --quiet; then + git commit -m "chore: sync lock files" + git push + fi From e99ae5ce930ff6c91bd1584c043512cab30928c0 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Sat, 4 Jul 2026 20:33:11 +0800 Subject: [PATCH 20/54] fix(sync-deps): Sync NPM lockfile --- .github/workflows/sync-deps.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-deps.yml b/.github/workflows/sync-deps.yml index be2fa5fa..28a0436c 100644 --- a/.github/workflows/sync-deps.yml +++ b/.github/workflows/sync-deps.yml @@ -25,7 +25,7 @@ jobs: # Sinkronisasi NPM - name: Sync package-lock.json run: | - npm install --package-lock-only + npm install --package-lock-only --ignore-scripts # Sinkronisasi Cargo - name: Sync Cargo.lock From 69f52c5fa36397d21630639292c7b39388f15509 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Sat, 4 Jul 2026 20:40:18 +0800 Subject: [PATCH 21/54] fix(sync-deps): Commit changes --- .github/workflows/sync-deps.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sync-deps.yml b/.github/workflows/sync-deps.yml index 28a0436c..bcbfd94f 100644 --- a/.github/workflows/sync-deps.yml +++ b/.github/workflows/sync-deps.yml @@ -32,7 +32,7 @@ jobs: run: | cargo generate-lockfile - # Commit kalau ada perubahan (opsional) + # Commit kalau ada perubahan - name: Commit changes run: | git config --global user.name 'github-actions[bot]' @@ -40,5 +40,6 @@ jobs: git add package-lock.json Cargo.lock if ! git diff --cached --quiet; then git commit -m "chore: sync lock files" - git push + # Push ke branch yang memicu workflow ini + git push origin HEAD:${GITHUB_REF_NAME} fi From f5f62f5d655dcb8592c72964c61aad9f6df90d64 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Sat, 4 Jul 2026 20:43:17 +0800 Subject: [PATCH 22/54] fix(sync-deps): Permissions issue --- .github/workflows/sync-deps.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/sync-deps.yml b/.github/workflows/sync-deps.yml index bcbfd94f..66f6e190 100644 --- a/.github/workflows/sync-deps.yml +++ b/.github/workflows/sync-deps.yml @@ -9,6 +9,8 @@ on: jobs: sync: runs-on: ubuntu-latest + permissions: + contents: write steps: - uses: actions/checkout@v4 with: From 1f9e4235b4fa3b2c6e4543802ff87451c4cce4ac Mon Sep 17 00:00:00 2001 From: Claycuy Date: Sat, 4 Jul 2026 20:46:23 +0800 Subject: [PATCH 23/54] fix(sync-deps): Commit refs issue --- .github/workflows/sync-deps.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-deps.yml b/.github/workflows/sync-deps.yml index 66f6e190..a0317160 100644 --- a/.github/workflows/sync-deps.yml +++ b/.github/workflows/sync-deps.yml @@ -43,5 +43,5 @@ jobs: if ! git diff --cached --quiet; then git commit -m "chore: sync lock files" # Push ke branch yang memicu workflow ini - git push origin HEAD:${GITHUB_REF_NAME} + git push origin HEAD:${GITHUB_HEAD_NAME} fi From 438d71fc33e5cce8463b034fcbde13fc3c240bd9 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Sat, 4 Jul 2026 20:48:34 +0800 Subject: [PATCH 24/54] fix(sync-deps): Commit refs issue --- .github/workflows/sync-deps.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-deps.yml b/.github/workflows/sync-deps.yml index a0317160..7af41763 100644 --- a/.github/workflows/sync-deps.yml +++ b/.github/workflows/sync-deps.yml @@ -43,5 +43,5 @@ jobs: if ! git diff --cached --quiet; then git commit -m "chore: sync lock files" # Push ke branch yang memicu workflow ini - git push origin HEAD:${GITHUB_HEAD_NAME} + git push origin HEAD:${GITHUB_HEAD_REF:-$GITHUB_REF_NAME} fi From 301abe5d13006c2fe58655016a1eddac582c9465 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Sat, 4 Jul 2026 20:53:18 +0800 Subject: [PATCH 25/54] fix(sync-deps): Commit refs issue --- .github/workflows/sync-deps.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sync-deps.yml b/.github/workflows/sync-deps.yml index 7af41763..7509cc97 100644 --- a/.github/workflows/sync-deps.yml +++ b/.github/workflows/sync-deps.yml @@ -39,9 +39,16 @@ jobs: run: | git config --global user.name 'github-actions[bot]' git config --global user.email 'github-actions[bot]@users.noreply.github.com' + + # 1. Pastikan kita punya perubahan terbaru dari remote + git fetch origin + + # 2. Rebase biar commit kamu ditaruh di atas perubahan terbaru + git pull --rebase origin ${GITHUB_HEAD_REF:-$GITHUB_REF_NAME} + git add package-lock.json Cargo.lock if ! git diff --cached --quiet; then git commit -m "chore: sync lock files" - # Push ke branch yang memicu workflow ini + # 3. Baru push git push origin HEAD:${GITHUB_HEAD_REF:-$GITHUB_REF_NAME} fi From d93dded0f3430b2a9e1fab00c9550afcd3f50eea Mon Sep 17 00:00:00 2001 From: Claycuy Date: Sat, 4 Jul 2026 20:55:48 +0800 Subject: [PATCH 26/54] fix(sync-deps): Unstaged changes issue --- .github/workflows/sync-deps.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sync-deps.yml b/.github/workflows/sync-deps.yml index 7509cc97..a6f80af9 100644 --- a/.github/workflows/sync-deps.yml +++ b/.github/workflows/sync-deps.yml @@ -40,15 +40,21 @@ jobs: git config --global user.name 'github-actions[bot]' git config --global user.email 'github-actions[bot]@users.noreply.github.com' - # 1. Pastikan kita punya perubahan terbaru dari remote + # 1. Bersihkan dulu (stash) perubahan apa pun yang ada sebelum pull + git stash + + # 2. Pastikan kita punya perubahan terbaru dari remote git fetch origin - # 2. Rebase biar commit kamu ditaruh di atas perubahan terbaru + # 3. Rebase biar commit kamu ditaruh di atas perubahan terbaru git pull --rebase origin ${GITHUB_HEAD_REF:-$GITHUB_REF_NAME} + # 4. Balikin lagi perubahan stash tadi + git stash pop || echo "No stash to pop" + git add package-lock.json Cargo.lock if ! git diff --cached --quiet; then git commit -m "chore: sync lock files" - # 3. Baru push + # 5. Baru push git push origin HEAD:${GITHUB_HEAD_REF:-$GITHUB_REF_NAME} fi From 235b4bcd5a21dba7326612a5a74802779daa708c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 4 Jul 2026 12:56:34 +0000 Subject: [PATCH 27/54] chore: sync lock files --- Cargo.lock | 12 ++++++------ package-lock.json | 23 +++++++++++++++++++++-- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ae3551d2..f536bdbf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -502,9 +502,9 @@ dependencies = [ [[package]] name = "napi" -version = "3.10.0" +version = "3.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abd366ba6a12e4bdbc360e1ad4e1f01da40c4395eef1f9e872d88f8b135e8048" +checksum = "0c71997d6f7ad4a756966e452426848ac27d3b37a295302d63afbbcce0270f93" dependencies = [ "bitflags", "ctor", @@ -525,9 +525,9 @@ checksum = "c9c366d2c8c60b86fa632df75f745509b52f9128f91a6bad4c796e44abb505e1" [[package]] name = "napi-derive" -version = "3.5.8" +version = "3.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6730ee4e7b335eac6d7cf10fc2525d92743bd4713a13cb2e6667f0e97322d7c3" +checksum = "d4ba572deef53e2c386759a8c2014175a62679d74ff83adc205c8bc0e0285727" dependencies = [ "convert_case", "ctor", @@ -539,9 +539,9 @@ dependencies = [ [[package]] name = "napi-derive-backend" -version = "5.1.0" +version = "5.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db5ccc18b1b16d1049dcbd3e1a21fdfbf3ce720b8944979c5e1a76d4e30d9f9f" +checksum = "ddd961eb2aa8965e3f29722d754f3a86907eb1984e2fbcbe3fe87b9a02d6bfba" dependencies = [ "convert_case", "proc-macro2", diff --git a/package-lock.json b/package-lock.json index 3af62271..695601d9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "lightvm", - "version": "0.1.0-alpha.8-nightly.20260701.305f0b7", + "version": "0.1.0-alpha.8-nightly.20260702.4e8db80", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "lightvm", - "version": "0.1.0-alpha.8-nightly.20260701.305f0b7", + "version": "0.1.0-alpha.8-nightly.20260702.4e8db80", "license": "Apache-2.0", "devDependencies": { "@commitlint/cli": "^21.0.1", @@ -2946,6 +2946,25 @@ "url": "https://ko-fi.com/dangreen" } }, + "node_modules/git-raw-commits/node_modules/conventional-commits-parser": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-6.4.0.tgz", + "integrity": "sha512-tvRg7FIBNlyPzjdG8wWRlPHQJJHI7DylhtRGeU9Lq+JuoPh5BKpPRX83ZdLrvXuOSu5Eo/e7SzOQhU4Hd2Miuw==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "@simple-libs/stream-utils": "^1.2.0", + "meow": "^13.0.0" + }, + "bin": { + "conventional-commits-parser": "dist/cli/index.js" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/git-raw-commits/node_modules/meow": { "version": "13.2.0", "resolved": "https://registry.npmjs.org/meow/-/meow-13.2.0.tgz", From 0bcab7920acb9d8fc5d9cd620cd24a4a6316f125 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Sun, 5 Jul 2026 07:13:09 +0800 Subject: [PATCH 28/54] chore: Added CREDITS.md --- CREDITS.md | 10 ++++++++++ README.md | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 CREDITS.md diff --git a/CREDITS.md b/CREDITS.md new file mode 100644 index 00000000..1c934074 --- /dev/null +++ b/CREDITS.md @@ -0,0 +1,10 @@ +# Credits & Origins + +## Originality Statement +LightVM is an original project, independently conceptualized and developed by me starting in February 2026. This project was born from my own vision and pure technical initiative. + +## Context +This virtual machine was created to fulfill a specific necessity: to provide a lightweight, high-performance runtime for a programming language I am currently developing. While there are other projects in the ecosystem that share similar naming conventions, please note that this repository serves as the official, original source code for my unique implementation. + +## Acknowledgments +Built with Rust, designed for high-performance low-level systems. This project represents my commitment to building independent, specialized tools from the ground up. diff --git a/README.md b/README.md index 25f173ab..b2d33be0 100644 --- a/README.md +++ b/README.md @@ -556,6 +556,7 @@ LightVM supports a wide range of platforms and architectures to ensure maximum o > [!WARNING] > __Nightly Support__: Support for `wasm32` for browsers is still in experimental stage. -## 📜 License & Changelog +## License & Changelog - This project is distributed using the [Apache-2.0 license](LICENSE). + - See [credits](./CREDITS.md) for information regarding the project's origin and originality. - See [changelogs](./docs/CHANGELOG.md) for the latest updates and release history. \ No newline at end of file From 272b33f6d2869e56f8fbea91942d39d70b73050e Mon Sep 17 00:00:00 2001 From: Claycuy Date: Sun, 5 Jul 2026 09:12:30 +0800 Subject: [PATCH 29/54] chore: Refactor scripts --- .husky/pre-commit | 2 +- package.json | 23 ++++++++++++----------- scripts/{ => bench}/ts-bench.js | 0 scripts/{ => build}/build-binary.js | 0 scripts/{ => build}/build-script.js | 0 scripts/{ => build}/build-wasm.js | 0 scripts/{ => test}/test-rust.js | 0 scripts/{run-tests.js => test/test-ts.js} | 0 scripts/{ => utils}/check-deps.js | 0 scripts/{ => utils}/cleaner.js | 0 scripts/{ => utils}/fix-imports.js | 0 scripts/{ => utils}/html-cleaner.js | 0 scripts/{ => utils}/server.js | 0 13 files changed, 13 insertions(+), 12 deletions(-) rename scripts/{ => bench}/ts-bench.js (100%) rename scripts/{ => build}/build-binary.js (100%) rename scripts/{ => build}/build-script.js (100%) rename scripts/{ => build}/build-wasm.js (100%) rename scripts/{ => test}/test-rust.js (100%) rename scripts/{run-tests.js => test/test-ts.js} (100%) rename scripts/{ => utils}/check-deps.js (100%) rename scripts/{ => utils}/cleaner.js (100%) rename scripts/{ => utils}/fix-imports.js (100%) rename scripts/{ => utils}/html-cleaner.js (100%) rename scripts/{ => utils}/server.js (100%) diff --git a/.husky/pre-commit b/.husky/pre-commit index 5c90ab74..d35266b0 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,5 +1,5 @@ npm run check:deps npm run cleaner -node ./scripts/fix-imports.js +npm run fix:imports git add ./ts/src/generated npx lint-staged \ No newline at end of file diff --git a/package.json b/package.json index 921093ee..135f74bf 100644 --- a/package.json +++ b/package.json @@ -35,27 +35,28 @@ "./types" ], "scripts": { - "test:rust": "node ./scripts/test-rust.js", - "test:ts": "node ./scripts/run-tests.js", + "test:rust": "node ./scripts/test/test-rust.js", + "test:ts": "node ./scripts/test/test-ts.js", "bench:rust": "cargo bench", - "bench:ts": "node ./scripts/ts-bench.js", + "bench:ts": "node ./scripts/bench/ts-bench.js", "testing:rust": "solas run .testings/native.rs", "testing:ts": "node .testings/napi.js", "build": "node ./esbuild.config.js", - "build:pack": "node ./scripts/build-script.js", + "build:pack": "node ./scripts/build/build-script.js", "build:wasm": "wasm-pack build --target web -- --features wasm", - "build:pack2": "node ./scripts/build-wasm.js", - "build:release": "node ./scripts/build-binary.js --local --silent", - "build:debug": "node ./scripts/build-binary.js --local --debug --silent", - "check:deps": "node ./scripts/check-deps.js", + "build:pack2": "node ./scripts/build/build-wasm.js", + "build:release": "node ./scripts/build/build-binary.js --local --silent", + "build:debug": "node ./scripts/build/build-binary.js --local --debug --silent", + "check:deps": "node ./scripts/utils/check-deps.js", "typecheck": "tsc", "prettier": "npx prettier ./ts/**/*.ts --write", "eslint": "npx eslint ./ts/**/*.ts --fix", "cspell": "cspell lint \"**/*.{js,ts,rs,md}\" --gitignore --quiet --no-summary", - "html:cleaner": "node ./scripts/html-cleaner.js", + "html:cleaner": "node ./scripts/utils/html-cleaner.js", + "fix:imports": "node ./scripts/utils/fix-imports.js", "prepare": "husky", - "cleaner": "node ./scripts/cleaner.js", - "server": "node ./scripts/server.js" + "cleaner": "node ./scripts/utils/cleaner.js", + "server": "node ./scripts/utils/server.js" }, "keywords": [ "lightvm", diff --git a/scripts/ts-bench.js b/scripts/bench/ts-bench.js similarity index 100% rename from scripts/ts-bench.js rename to scripts/bench/ts-bench.js diff --git a/scripts/build-binary.js b/scripts/build/build-binary.js similarity index 100% rename from scripts/build-binary.js rename to scripts/build/build-binary.js diff --git a/scripts/build-script.js b/scripts/build/build-script.js similarity index 100% rename from scripts/build-script.js rename to scripts/build/build-script.js diff --git a/scripts/build-wasm.js b/scripts/build/build-wasm.js similarity index 100% rename from scripts/build-wasm.js rename to scripts/build/build-wasm.js diff --git a/scripts/test-rust.js b/scripts/test/test-rust.js similarity index 100% rename from scripts/test-rust.js rename to scripts/test/test-rust.js diff --git a/scripts/run-tests.js b/scripts/test/test-ts.js similarity index 100% rename from scripts/run-tests.js rename to scripts/test/test-ts.js diff --git a/scripts/check-deps.js b/scripts/utils/check-deps.js similarity index 100% rename from scripts/check-deps.js rename to scripts/utils/check-deps.js diff --git a/scripts/cleaner.js b/scripts/utils/cleaner.js similarity index 100% rename from scripts/cleaner.js rename to scripts/utils/cleaner.js diff --git a/scripts/fix-imports.js b/scripts/utils/fix-imports.js similarity index 100% rename from scripts/fix-imports.js rename to scripts/utils/fix-imports.js diff --git a/scripts/html-cleaner.js b/scripts/utils/html-cleaner.js similarity index 100% rename from scripts/html-cleaner.js rename to scripts/utils/html-cleaner.js diff --git a/scripts/server.js b/scripts/utils/server.js similarity index 100% rename from scripts/server.js rename to scripts/utils/server.js From 3c5490373ac6f2e5866e2dd2d2875e456594c61c Mon Sep 17 00:00:00 2001 From: Claycuy Date: Sun, 5 Jul 2026 09:16:15 +0800 Subject: [PATCH 30/54] fix(quality-gate): Run rust tests error --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c81de1b..4b57e3e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,7 +67,7 @@ jobs: - name: Run Rust Tests run: | npm run test:rust - node ./scripts/fix-imports.js + npm run fix:imports - name: Run Typecheck & Tests run: | From 9f385bfc33116f7e8e3758c53e761a9ce1543bd0 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Sun, 5 Jul 2026 09:25:01 +0800 Subject: [PATCH 31/54] fix(scripts): Path error in test-ts.js --- scripts/test/test-ts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/test/test-ts.js b/scripts/test/test-ts.js index aca2d1bc..22e71619 100644 --- a/scripts/test/test-ts.js +++ b/scripts/test/test-ts.js @@ -39,7 +39,7 @@ function run() { `${s.bold}${s.green}✔${s.reset} ${s.bold}Rust build success!${s.reset}\n`, ); - const rootDir = path.resolve(__dirname, '..'); + const rootDir = path.resolve(__dirname, '../..'); const binariesDir = path.join(rootDir, 'binaries'); const sourcePath = path.join(rootDir, 'target/release/liblightvm.so'); const destPath = path.join(binariesDir, 'lightvm.node'); From f30ae2093007e00735df4bf9eb0e78783517f492 Mon Sep 17 00:00:00 2001 From: claycuy <155298405+claycuy@users.noreply.github.com> Date: Sun, 5 Jul 2026 09:53:39 +0800 Subject: [PATCH 32/54] fix: Update .github/workflows/sync-deps.yml Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- .github/workflows/sync-deps.yml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/workflows/sync-deps.yml b/.github/workflows/sync-deps.yml index a6f80af9..792239c7 100644 --- a/.github/workflows/sync-deps.yml +++ b/.github/workflows/sync-deps.yml @@ -38,19 +38,10 @@ jobs: - name: Commit changes run: | git config --global user.name 'github-actions[bot]' - git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git config --global user.email 'github-actions[bot]`@users.noreply.github.com`' - # 1. Bersihkan dulu (stash) perubahan apa pun yang ada sebelum pull - git stash - - # 2. Pastikan kita punya perubahan terbaru dari remote git fetch origin - - # 3. Rebase biar commit kamu ditaruh di atas perubahan terbaru - git pull --rebase origin ${GITHUB_HEAD_REF:-$GITHUB_REF_NAME} - - # 4. Balikin lagi perubahan stash tadi - git stash pop || echo "No stash to pop" + git pull --rebase --autostash origin ${GITHUB_HEAD_REF:-$GITHUB_REF_NAME} git add package-lock.json Cargo.lock if ! git diff --cached --quiet; then From 70e4c4afd475bc00c3a622033750f64313a122a6 Mon Sep 17 00:00:00 2001 From: claycuy <155298405+claycuy@users.noreply.github.com> Date: Sun, 5 Jul 2026 09:54:41 +0800 Subject: [PATCH 33/54] fix: Update .github/workflows/stats.yml Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- .github/workflows/stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stats.yml b/.github/workflows/stats.yml index 7af773d5..84b80f39 100644 --- a/.github/workflows/stats.yml +++ b/.github/workflows/stats.yml @@ -14,4 +14,4 @@ jobs: runs-on: ubuntu-latest steps: - name: Fetch and Update Gist - run: bash .github/scripts/stats/fetch_update_gish.sh + run: bash .github/scripts/stats/fetch_update_gist.sh From d159065c866a84290db9721959e4c520f955a123 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Sun, 5 Jul 2026 09:30:51 +0800 Subject: [PATCH 34/54] fix(scripts): Path error in ts-bench.js --- scripts/bench/ts-bench.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/bench/ts-bench.js b/scripts/bench/ts-bench.js index 1467395e..3aef4e5d 100644 --- a/scripts/bench/ts-bench.js +++ b/scripts/bench/ts-bench.js @@ -37,7 +37,7 @@ console.log( `${s.bold}${s.green}✔${s.reset} ${s.bold}Rust build success!${s.reset}\n`, ); -const rootDir = path.resolve(__dirname, '..'); +const rootDir = path.resolve(__dirname, '../..'); const binariesDir = path.join(rootDir, 'binaries'); const sourcePath = path.join(rootDir, 'target/release/liblightvm.so'); const destPath = path.join(binariesDir, 'lightvm.node'); From 56adf31447ab557a10313359c939afc5ea0051f0 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Sun, 5 Jul 2026 10:03:50 +0800 Subject: [PATCH 35/54] chore: Update cspell.config.js --- cspell.config.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cspell.config.js b/cspell.config.js index 121e30d6..43d7736c 100644 --- a/cspell.config.js +++ b/cspell.config.js @@ -33,7 +33,8 @@ export default { 'trin', 'unref', 'accessindex', - 'vmconfig' + 'vmconfig', + 'claycuy' ], ignorePaths: [ 'node_modules/**', From 00cae7e530cd28982ba3beb00eb88746d76fa145 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Sun, 5 Jul 2026 10:04:15 +0800 Subject: [PATCH 36/54] fix(check-tokens): Create issue script extension --- .github/scripts/tokens/{create_issue.sh => create_issue.js} | 0 .github/workflows/check-tokens.yml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename .github/scripts/tokens/{create_issue.sh => create_issue.js} (100%) diff --git a/.github/scripts/tokens/create_issue.sh b/.github/scripts/tokens/create_issue.js similarity index 100% rename from .github/scripts/tokens/create_issue.sh rename to .github/scripts/tokens/create_issue.js diff --git a/.github/workflows/check-tokens.yml b/.github/workflows/check-tokens.yml index 57a23ca6..a4cc0347 100644 --- a/.github/workflows/check-tokens.yml +++ b/.github/workflows/check-tokens.yml @@ -38,7 +38,7 @@ jobs: if: steps.check_npm.outputs.status != 'valid' || steps.check_crates.outputs.status != 'valid' uses: actions/github-script@v7 with: - script: bash .github/scripts/tokens/create_issue.sh + script: node .github/scripts/tokens/create_issue.js - name: Force Workflow Failure if: steps.check_npm.outputs.status != 'valid' || steps.check_crates.outputs.status != 'valid' From 7781e915227d934c67db504c1ecbebdb3182e7c1 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Sun, 5 Jul 2026 13:14:44 +0800 Subject: [PATCH 37/54] fix(stats): Silent failure --- .github/scripts/stats/fetch_update_gist.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/scripts/stats/fetch_update_gist.sh b/.github/scripts/stats/fetch_update_gist.sh index 71a56710..ab6ffb4a 100644 --- a/.github/scripts/stats/fetch_update_gist.sh +++ b/.github/scripts/stats/fetch_update_gist.sh @@ -8,7 +8,7 @@ TRAFFIC_DATA=$(curl -s -H "Authorization: token ${{ secrets.LIGHTVM_PAT }}" \ TOTAL_VIEWS=$(echo $TRAFFIC_DATA | jq '.count // 0') UNIQUE_VISITORS=$(echo $TRAFFIC_DATA | jq '.uniques // 0') -curl -s -X PATCH -H "Authorization: token ${{ secrets.LIGHTVM_PAT }}" \ +curl -s --fail -X PATCH -H "Authorization: token ${{ secrets.LIGHTVM_PAT }}" \ -H "Content-Type: application/json" \ -d "{\"files\":{\"stats.json\":{\"content\":\"{\\\"clones\\\": $CLONES, \\\"total_views\\\": $TOTAL_VIEWS, \\\"unique_visitors\\\": $UNIQUE_VISITORS}\"}}}" \ -"https://api.github.com/gists/${{ secrets.GIST_ID }}" \ No newline at end of file +"https://api.github.com/gists/${{ secrets.GIST_ID }}" From 97aca40b3840c516a2c6c1e810321a17de775b50 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Sun, 5 Jul 2026 13:22:38 +0800 Subject: [PATCH 38/54] fix(stats): Env variables --- .github/scripts/stats/fetch_update_gist.sh | 12 ++++++------ .github/workflows/stats.yml | 5 +++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/scripts/stats/fetch_update_gist.sh b/.github/scripts/stats/fetch_update_gist.sh index ab6ffb4a..3c87db39 100644 --- a/.github/scripts/stats/fetch_update_gist.sh +++ b/.github/scripts/stats/fetch_update_gist.sh @@ -1,14 +1,14 @@ -CLONES=$(curl -s -H "Authorization: token ${{ secrets.LIGHTVM_PAT }}" \ -"https://api.github.com/repos/${{ github.repository }}/traffic/clones" \ +CLONES=$(curl -s -H "Authorization: token $LIGHTVM_PAT" \ +"https://api.github.com/repos/$GITHUB_REPOSITORY/traffic/clones" \ | jq '.count // 0') -TRAFFIC_DATA=$(curl -s -H "Authorization: token ${{ secrets.LIGHTVM_PAT }}" \ -"https://api.github.com/repos/${{ github.repository }}/traffic/views") +TRAFFIC_DATA=$(curl -s -H "Authorization: token $LIGHTVM_PAT" \ +"https://api.github.com/repos/$GITHUB_REPOSITORY/traffic/views") TOTAL_VIEWS=$(echo $TRAFFIC_DATA | jq '.count // 0') UNIQUE_VISITORS=$(echo $TRAFFIC_DATA | jq '.uniques // 0') -curl -s --fail -X PATCH -H "Authorization: token ${{ secrets.LIGHTVM_PAT }}" \ +curl -s --fail -X PATCH -H "Authorization: token $LIGHTVM_PAT" \ -H "Content-Type: application/json" \ -d "{\"files\":{\"stats.json\":{\"content\":\"{\\\"clones\\\": $CLONES, \\\"total_views\\\": $TOTAL_VIEWS, \\\"unique_visitors\\\": $UNIQUE_VISITORS}\"}}}" \ -"https://api.github.com/gists/${{ secrets.GIST_ID }}" +"https://api.github.com/gists/$GIST_ID" diff --git a/.github/workflows/stats.yml b/.github/workflows/stats.yml index 84b80f39..51bf5833 100644 --- a/.github/workflows/stats.yml +++ b/.github/workflows/stats.yml @@ -14,4 +14,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Fetch and Update Gist + env: + LIGHTVM_PAT: ${{ secrets.LIGHTVM_PAT }} + GITHUB_REPOSITORY: ${{ github.repository }} + GIST_ID: ${{ secrets.GIST_ID }} run: bash .github/scripts/stats/fetch_update_gist.sh + From 72daad19d0de78d3500f15758f205748628be510 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Sun, 5 Jul 2026 13:27:19 +0800 Subject: [PATCH 39/54] fix(publish): Env variables --- .github/scripts/publish/build_release.sh | 10 +++++----- .github/workflows/publish.yml | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/scripts/publish/build_release.sh b/.github/scripts/publish/build_release.sh index 0b6ec62e..c6545958 100644 --- a/.github/scripts/publish/build_release.sh +++ b/.github/scripts/publish/build_release.sh @@ -1,15 +1,15 @@ -if [[ "${{ matrix.platform }}" == *"android"* ]]; then - cargo build --release --target ${{ matrix.target }} -elif [[ "${{ matrix.platform }}" == *"musl"* ]]; then +if [[ "$PLATFORM" == *"android"* ]]; then + cargo build --release --target $TARGET +elif [[ "$PLATFORM" == *"musl"* ]]; then if [ ! -f "./cross" ]; then curl -L https://github.com/cross-rs/cross/releases/latest/download/cross-x86_64-unknown-linux-musl.tar.gz | tar xz chmod +x cross fi - RUSTFLAGS="-C target-feature=-crt-static" ./cross build --release --target ${{ matrix.target }} + RUSTFLAGS="-C target-feature=-crt-static" ./cross build --release --target $TARGET else if [ ! -f "./cross" ]; then curl -L https://github.com/cross-rs/cross/releases/latest/download/cross-x86_64-unknown-linux-musl.tar.gz | tar xz chmod +x cross fi - ./cross build --release --target ${{ matrix.target }} + ./cross build --release --target $TARGET fi diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 027bb483..c5bb0ac0 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -119,6 +119,9 @@ jobs: contains(matrix.platform, 'musl') || contains(matrix.platform, 'arm64') || matrix.platform == 'linux-ia32' + env: + PLATFORM: ${{ matrix.platform }} + TARGET: ${{ matrix.target }} run: bash .github/scripts/publish/build_release.sh - name: Build WASM if: matrix.platform == 'browser-wasm' From 62d4fb9e580508b7d76b28e138457131051f7a76 Mon Sep 17 00:00:00 2001 From: claycuy <155298405+claycuy@users.noreply.github.com> Date: Sun, 5 Jul 2026 13:34:50 +0800 Subject: [PATCH 40/54] fix: Update .github/scripts/ci/deep_audit.sh Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- .github/scripts/ci/deep_audit.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/ci/deep_audit.sh b/.github/scripts/ci/deep_audit.sh index fcc12d45..6f1ddf8b 100644 --- a/.github/scripts/ci/deep_audit.sh +++ b/.github/scripts/ci/deep_audit.sh @@ -12,7 +12,7 @@ if [ -n "$MISSING_COPYRIGHT" ]; then exit 1 fi -JUNK_CHECK=$(echo "$FILES" | xargs awk 'NR==1 && /^\/\/ [A-Za-z0-9_-]+\.(ts|rs)$/ {print FILENAME}') +JUNK_CHECK=$(echo "$FILES" | xargs awk 'FNR==1 && /^\/\/ [A-Za-z0-9_-]+\.(ts|rs)$/ {print FILENAME}') if [ -n "$JUNK_CHECK" ]; then echo "The first line is just the file name (Junk):" echo "$JUNK_CHECK" From eb90396dd35b72377f103fe01013f37eb8d06725 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Sun, 5 Jul 2026 14:16:48 +0800 Subject: [PATCH 41/54] fix(production): Rev parse issue --- .github/scripts/production/validate_version_tag.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/scripts/production/validate_version_tag.sh b/.github/scripts/production/validate_version_tag.sh index 6582ad94..f2b85bf0 100644 --- a/.github/scripts/production/validate_version_tag.sh +++ b/.github/scripts/production/validate_version_tag.sh @@ -1,5 +1,4 @@ -VERSION="${{ github.event.inputs.version }}" -if git rev-parse "v$VERSION" >/dev/null 2>&1; then +if git rev-parse "refs/tags/v$VERSION" >/dev/null 2>&1; then echo "Error: Versi $VERSION sudah ada tag-nya! Ganti versi dulu." exit 1 fi From 7f472c036331ff2108c859f55a5b21cda63cfba2 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Sun, 5 Jul 2026 14:27:15 +0800 Subject: [PATCH 42/54] fix(production): Runtime arguments issue --- .github/scripts/production/validate_version_tag.sh | 1 + .github/workflows/production.yml | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/scripts/production/validate_version_tag.sh b/.github/scripts/production/validate_version_tag.sh index f2b85bf0..4d43f5c9 100644 --- a/.github/scripts/production/validate_version_tag.sh +++ b/.github/scripts/production/validate_version_tag.sh @@ -1,3 +1,4 @@ +VERSION="$1" if git rev-parse "refs/tags/v$VERSION" >/dev/null 2>&1; then echo "Error: Versi $VERSION sudah ada tag-nya! Ganti versi dulu." exit 1 diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml index d44083c6..de6fe1ac 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/production.yml @@ -19,7 +19,8 @@ jobs: fetch-depth: 0 - name: Validate Version & Check Tag - run: bash .github/scripts/production/validate_version_tag.sh + run: bash .github/scripts/production/validate_version_tag.sh "${{ github.event.inputs.version }}" + - name: Generate Release Notes run: bash .github/scripts/production/generate_release_notes.sh From 7024fc4d205df1a93cdfa679102ce4e5cc448bd2 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Sun, 5 Jul 2026 14:36:00 +0800 Subject: [PATCH 43/54] chore: Update .lintstagedrc.js --- .github/scripts/production/generate_release_notes.sh | 2 +- .lintstagedrc.js | 2 +- cspell.config.js | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/scripts/production/generate_release_notes.sh b/.github/scripts/production/generate_release_notes.sh index 15b49f53..d7a4e320 100644 --- a/.github/scripts/production/generate_release_notes.sh +++ b/.github/scripts/production/generate_release_notes.sh @@ -5,7 +5,7 @@ LAST_STABLE=$(git tag --sort=-creatordate | grep -v "nightly" | head -n 1 || ech NIGHTLIES=$(git tag | grep "nightly" | sort -V) if [ -n "$LAST_STABLE" ]; then - FINAL_NIGHTLIES=$(echo "$NIGHTLIES" | awk -v last="$LAST_STABLE" '$0 > last') + FINAL_NIGHTLIES=$(echo -e "$NIGHTLIES\n$LAST_STABLE" | sort -V | sed -n "/$LAST_STABLE/,\$p" | grep -v "$LAST_STABLE") else FINAL_NIGHTLIES="$NIGHTLIES" fi diff --git a/.lintstagedrc.js b/.lintstagedrc.js index 9f24fad8..02c283b6 100644 --- a/.lintstagedrc.js +++ b/.lintstagedrc.js @@ -1,5 +1,5 @@ export default { - "*.{js,ts,rs,md}": "npm run cspell", + "*.{js,ts,rs,md,sh,yml}": "npm run cspell", "{ts/src,ts/tests,scripts}**/*.{js,ts}": [ () => "npm run typecheck", "eslint --fix", diff --git a/cspell.config.js b/cspell.config.js index 43d7736c..daa8e5e7 100644 --- a/cspell.config.js +++ b/cspell.config.js @@ -34,7 +34,9 @@ export default { 'unref', 'accessindex', 'vmconfig', - 'claycuy' + 'claycuy', + 'creatordate', + 'nightlies' ], ignorePaths: [ 'node_modules/**', From a492c4e82d1165a660d34eefc6b543c6e600412c Mon Sep 17 00:00:00 2001 From: claycuy <155298405+claycuy@users.noreply.github.com> Date: Sun, 5 Jul 2026 15:20:43 +0800 Subject: [PATCH 44/54] fix: Update .github/scripts/production/validate_version_tag.sh Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- .github/scripts/production/validate_version_tag.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/scripts/production/validate_version_tag.sh b/.github/scripts/production/validate_version_tag.sh index 4d43f5c9..a8250e34 100644 --- a/.github/scripts/production/validate_version_tag.sh +++ b/.github/scripts/production/validate_version_tag.sh @@ -1,4 +1,8 @@ VERSION="$1" +if [ -z "$VERSION" ]; then + echo "Error: Version argument is required." + exit 1 +fi if git rev-parse "refs/tags/v$VERSION" >/dev/null 2>&1; then echo "Error: Versi $VERSION sudah ada tag-nya! Ganti versi dulu." exit 1 From ecd2610e8e75822ebea6c26dde998d42efc2a86c Mon Sep 17 00:00:00 2001 From: claycuy <155298405+claycuy@users.noreply.github.com> Date: Sun, 5 Jul 2026 15:21:48 +0800 Subject: [PATCH 45/54] fix: Update .github/scripts/stats/fetch_update_gist.sh Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- .github/scripts/stats/fetch_update_gist.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/scripts/stats/fetch_update_gist.sh b/.github/scripts/stats/fetch_update_gist.sh index 3c87db39..715a2abb 100644 --- a/.github/scripts/stats/fetch_update_gist.sh +++ b/.github/scripts/stats/fetch_update_gist.sh @@ -1,12 +1,12 @@ -CLONES=$(curl -s -H "Authorization: token $LIGHTVM_PAT" \ +CLONES=$(curl -s --fail -H "Authorization: token $LIGHTVM_PAT" \ "https://api.github.com/repos/$GITHUB_REPOSITORY/traffic/clones" \ | jq '.count // 0') -TRAFFIC_DATA=$(curl -s -H "Authorization: token $LIGHTVM_PAT" \ +TRAFFIC_DATA=$(curl -s --fail -H "Authorization: token $LIGHTVM_PAT" \ "https://api.github.com/repos/$GITHUB_REPOSITORY/traffic/views") -TOTAL_VIEWS=$(echo $TRAFFIC_DATA | jq '.count // 0') -UNIQUE_VISITORS=$(echo $TRAFFIC_DATA | jq '.uniques // 0') +TOTAL_VIEWS=$(echo "$TRAFFIC_DATA" | jq '.count // 0') +UNIQUE_VISITORS=$(echo "$TRAFFIC_DATA" | jq '.uniques // 0') curl -s --fail -X PATCH -H "Authorization: token $LIGHTVM_PAT" \ -H "Content-Type: application/json" \ From 3a1e4f8925c372c484fa07bbc7a06522218786ef Mon Sep 17 00:00:00 2001 From: Claycuy Date: Sun, 5 Jul 2026 16:04:56 +0800 Subject: [PATCH 46/54] chore: Added sync agents script --- .coderabbit.yml | 21 ++++++++++++++ package.json | 3 +- scripts/utils/sync-agents.js | 55 ++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 scripts/utils/sync-agents.js diff --git a/.coderabbit.yml b/.coderabbit.yml index d8ae73c5..c85d1430 100644 --- a/.coderabbit.yml +++ b/.coderabbit.yml @@ -1,6 +1,27 @@ language: "en" reviews: profile: "chill" + system_instructions: | + # AGENTS_START + # Instructions for AI Coding Agent + + You are an expert developer assistant integrated into Acode. You MUST strictly follow these rules: + + ## Core Restriction: Passive Mode + - **READ-ONLY BY DEFAULT:** You are here to assist and provide suggestions. You are FORBIDDEN from modifying, refactoring, or applying changes to any existing code unless I explicitly command you to "apply" or "implement" the changes. + - **NO AUTOCORRECT:** Do not touch code that is already working. If you see code you think is "wrong" but it wasn't the target of my query, leave it alone. + - **READ FIRST:** When I ask you to read a file or reference instructions, strictly provide analysis or answers based on that reading. DO NOT generate code or modify files until I specifically ask for it. + + ## Code Style & Formatting + - **Indentation:** ALWAYS use 2 spaces for indentation. + - **Clean Code:** Keep code concise. No unnecessary comments, no "filler" code. + - **Strictly Stable:** Use ONLY stable Rust features. NO `unstable` or `nightly` syntax. + + ## Behavior + - If a request is ambiguous, ASK ME before doing anything. + - Do not perform "fix-all" or "auto-refactor" tasks unless I explicitly define the scope of the fix. + + # AGENTS_END request_review_trigger: exclude_labels: - "wip" diff --git a/package.json b/package.json index 135f74bf..12a9c26e 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,8 @@ "fix:imports": "node ./scripts/utils/fix-imports.js", "prepare": "husky", "cleaner": "node ./scripts/utils/cleaner.js", - "server": "node ./scripts/utils/server.js" + "server": "node ./scripts/utils/server.js", + "sync:agents": "node ./scripts/utils/sync-agents.js" }, "keywords": [ "lightvm", diff --git a/scripts/utils/sync-agents.js b/scripts/utils/sync-agents.js new file mode 100644 index 00000000..038f08bb --- /dev/null +++ b/scripts/utils/sync-agents.js @@ -0,0 +1,55 @@ +/** + * Copyright 2026 SoTeen Studio + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ + +import fs from 'fs'; + +const AGENTS_PATH = 'AGENTS.md'; +const CODERABBIT_PATH = '.coderabbit.yml'; + +const s = { + reset: '\x1b[0m', + bold: '\x1b[1m', + cyan: '\x1b[36m', + green: '\x1b[32m', + red: '\x1b[31m', +}; + +const logger = { + success: (msg) => console.log(`${s.bold}${s.green}✔${s.reset} ${msg}`), + error: (msg, detail) => + console.error(`\n${s.bold}${s.red}𐄂 ${msg}${s.reset}`, detail || ''), +}; + +try { + const agentsContent = fs.readFileSync(AGENTS_PATH, 'utf8'); + + const indentedAgents = agentsContent + .split('\n') + .map((line) => ` ${line}`) + .join('\n'); + + let crConfig = fs.readFileSync(CODERABBIT_PATH, 'utf8'); + + const regex = /# AGENTS_START[\s\S]*?# AGENTS_END/; + const replacement = `# AGENTS_START\n${indentedAgents}\n # AGENTS_END`; + + if (regex.test(crConfig)) { + crConfig = crConfig.replace(regex, replacement); + fs.writeFileSync(CODERABBIT_PATH, crConfig); + logger.success('AGENTS.md successfully synced to .coderabbit.yml!'); + } else { + throw new Error( + 'Placeholder # AGENTS_START / # AGENTS_END not found in .coderabbit.yml', + ); + } +} catch (err) { + logger.error('Sync process failed:', err.message); + process.exit(1); +} From da2be3f2b3586777f02b4df850319ccae908a2bd Mon Sep 17 00:00:00 2001 From: Claycuy Date: Mon, 6 Jul 2026 11:47:05 +0800 Subject: [PATCH 47/54] chore: Update solas.toml --- solas.toml | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/solas.toml b/solas.toml index 44f6c286..4c9354bc 100644 --- a/solas.toml +++ b/solas.toml @@ -13,20 +13,24 @@ desc = "Checking code performance" commands = ["clean", "header", "track"] # Commands for developers +# ======================= +# test scripts [scripts.test-rust] desc = "Running unit tests on .rs files" -commands = ["cargo test"] +commands = ["node ./scripts/test/test-rust.js"] [scripts.test-ts] desc = "Running unit tests on .ts file$" -commands = ["node ./scripts/run-tests.js"] +commands = ["node ./scripts/test/test-ts.js"] +# bench scripts [scripts.bench-rust] desc = "To get benchmark results from Rust code" commands = ["cargo bench"] [scripts.bench-ts] desc = "To get benchmark results from TypeScript code" -commands = ["node ./scripts/ts-bench.js"] +commands = ["node ./scripts/bench/ts-bench.js"] +# testing scripts [scripts.testing-rust] desc = "Running tests for Rust interfaces" commands = ["solas run .testings/native.rs"] @@ -34,34 +38,36 @@ commands = ["solas run .testings/native.rs"] desc = "Running tests for TypeScript interfaces" commands = ["node --enable-source-maps .testings/napi.js"] +# build scripts [scripts.build] desc = "Generating build results from TypeScript source" commands = ["node ./esbuild.config.js"] [scripts.build-pack] desc = "NPM package creation simulation" -commands = ["node ./scripts/build-script.js"] +commands = ["node ./scripts/build/build-script.js"] [scripts.build-wasm] desc = "Generating a WASM build from Rust sources" commands = ["wasm-pack build --target web -- --features wasm"] [scripts.build-pack2] desc = "NPM package creation simulation (WASM)" -commands = ["node ./scripts/build-wasm.js"] +commands = ["node ./scripts/build/build-wasm.js"] [scripts.build-release] desc = "Create a build release .tgz file" -commands = ["node ./scripts/build-binary.js --local --silent"] +commands = ["node ./scripts/build/build-binary.js --local --silent"] [scripts.build-debug] desc = "Create a build debug .tgz file" -commands = ["node ./scripts/build-binary.js --local --debug --silent"] +commands = ["node ./scripts/build/build-binary.js --local --debug --silent"] +# utils scripts [scripts.check-deps] desc = "Checking installed local dependencies" -commands = ["node ./scripts/check-deps.js"] +commands = ["node ./scripts/utils/check-deps.js"] [scripts.typecheck] desc = "Type checking" commands = ["tsc"] [scripts.html-cleaner] desc = "Cleaning up HTML code" -commands = ["node ./scripts/html-cleaner.js"] +commands = ["node ./scripts/utils/html-cleaner.js"] [scripts.prettier] desc = "Formatting code" commands = ["npx prettier ./ts/**/*.ts --write"] @@ -73,10 +79,10 @@ desc = "Prepare Husky" commands = ["npx husky"] [scripts.cleaner] desc = "Delete unused files and folders" -commands = ["node ./scripts/cleaner.js"] +commands = ["node ./scripts/utils/cleaner.js"] [scripts.server] desc = "Running the WASM testing server" -commands = ["node ./scripts/server.js"] +commands = ["node ./scripts/utils/server.js"] [copyright] license = "apache" From 726e0f1de6950f2f9c5b3854d8b835da57fd1883 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Mon, 6 Jul 2026 11:52:49 +0800 Subject: [PATCH 48/54] chore: Update .gitattributes --- .gitattributes | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitattributes b/.gitattributes index 62957573..59059115 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7,4 +7,5 @@ /ts/src/generated/** linguist-detectable=false /types/** linguist-detectable=false /.testings/** linguist-detectable=false +*.sh linguist-detectable=false *.d.ts linguist-documentation=true From dc6986a3a9773e32a094e90cc76a72d8a9630fb2 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Mon, 6 Jul 2026 12:04:56 +0800 Subject: [PATCH 49/54] chore: Update .lintstagedrc.js --- .lintstagedrc.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.lintstagedrc.js b/.lintstagedrc.js index 02c283b6..2f5fab48 100644 --- a/.lintstagedrc.js +++ b/.lintstagedrc.js @@ -13,7 +13,8 @@ export default { ], "rust/**/*.rs": [ "sh -c 'cargo fmt --'", - "sh -c 'cargo clippy --color always -- -D warnings'" + "sh -c 'cargo clippy --color always -- -D warnings'", + "sh -c 'cargo test --features node --no-run'" ], ".testings/**/*.rs": [ "sh -c 'cargo fmt --'", From f99dc56955119505ae01ea605a03e750b5ececad Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 6 Jul 2026 04:09:27 +0000 Subject: [PATCH 50/54] chore: sync lock files --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f536bdbf..6e71ba80 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -118,9 +118,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.2.65" +version = "1.2.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e228eec9be7c17ccb640b59b36a5cd805ea2a564a4c5e162c2f659fea30d3b96" +checksum = "f5d6cac793997bd970000024b2934968efe83b382de4fdcf4fcb46b6ee4ad996" dependencies = [ "find-msvc-tools", "shlex", @@ -276,9 +276,9 @@ checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" [[package]] name = "ctor" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01334b89b69ff726750c5ce5073fc8bd860e99aa9a8fc5ca11b04730e3aee97a" +checksum = "fb22e947478ccf9dc44d8922042c677a63fbb88f2cb468521d1145816e5087cb" [[package]] name = "either" From d1c5e26313feac4ecd06f17c64f22bbdd27d4ecc Mon Sep 17 00:00:00 2001 From: Claycuy Date: Mon, 6 Jul 2026 12:32:15 +0800 Subject: [PATCH 51/54] test(core): Added unit tests --- rust/src/types/instructions.rs | 20 ++++++++++++++++++++ rust/src/types/value.rs | 2 +- rust/src/vm/execute.rs | 33 +++++++++++++++++++++++++++++++++ rust/src/vm/run.rs | 17 +++++++++++++++++ 4 files changed, 71 insertions(+), 1 deletion(-) diff --git a/rust/src/types/instructions.rs b/rust/src/types/instructions.rs index 821328d3..2a29674c 100644 --- a/rust/src/types/instructions.rs +++ b/rust/src/types/instructions.rs @@ -552,3 +552,23 @@ impl Instructions { } } } +#[cfg(test)] +mod tests { + use super::*; + use serde_json::json; + #[test] + fn test_instruction_round_trip() { + let json_input = json!(["push", 123]); + let instr = Instructions::from_json_array(&json_input).unwrap(); + match instr { + Instructions::Push(Value::Int16(_)) => assert!(true), + _ => panic!("Wrong data type!"), + } + } + #[test] + fn test_unknown_opcode_handling() { + let json_input = json!(["random_nonsense", 1]); + let result = Instructions::from_json_array(&json_input); + assert!(result.is_err()); + } +} diff --git a/rust/src/types/value.rs b/rust/src/types/value.rs index a7823d4a..b89e0958 100644 --- a/rust/src/types/value.rs +++ b/rust/src/types/value.rs @@ -51,7 +51,7 @@ pub struct FuncMetadata { pub start: usize, pub end: usize, } -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize, Default)] pub struct RunOptions { pub entry: Option, pub args: Vec, diff --git a/rust/src/vm/execute.rs b/rust/src/vm/execute.rs index 77bc23cb..5fdbea28 100644 --- a/rust/src/vm/execute.rs +++ b/rust/src/vm/execute.rs @@ -205,3 +205,36 @@ pub fn execute( } Ok(Value::Undefined) } +#[cfg(test)] +mod tests { + use super::*; + use crate::types::{instructions::Instructions, value::Value}; + use std::sync::Arc; + use std::sync::atomic::AtomicBool; + #[test] + fn test_execute_basic_math_and_return() { + let bytecode = vec![ + Instructions::PushInt32(5), + Instructions::PushInt32(10), + Instructions::Add(crate::types::primitive_types::PrimitiveTypes::Int), + Instructions::Stop, + ]; + let halt_flag = Arc::new(AtomicBool::new(false)); + let options = crate::types::value::RunOptions { + capture_return: true, + ..Default::default() + }; + let result = execute(bytecode, Some(options), Some(halt_flag)); + assert!(result.is_ok()); + } + #[test] + fn test_halt_flag_behavior() { + let bytecode = vec![Instructions::Jump(0)]; + let halt_flag = Arc::new(AtomicBool::new(false)); + let flag_clone = halt_flag.clone(); + flag_clone.store(true, std::sync::atomic::Ordering::Relaxed); + let result = execute(bytecode, None, Some(halt_flag)); + assert!(result.is_ok()); + assert_eq!(result.unwrap(), Value::Undefined); + } +} diff --git a/rust/src/vm/run.rs b/rust/src/vm/run.rs index 082f583d..bd14cc06 100644 --- a/rust/src/vm/run.rs +++ b/rust/src/vm/run.rs @@ -41,3 +41,20 @@ pub fn run(bytecode_json: &str, options: Option) -> String { } } } +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn test_run_with_valid_json() { + let json = r#"[["PushInt32", 10], ["Stop"]]"#; + let result = run(json, None); + assert!(result.contains("10") || result.contains("status")); + } + #[test] + fn test_run_with_invalid_instruction() { + let json = r#"[["random nonsense", 0]]"#; + let result = run(json, None); + assert!(result.contains("error")); + assert!(result.contains("message")); + } +} From 84ed9c4ebe7cbc94a8081eacc843d6060a70f558 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Mon, 6 Jul 2026 12:59:51 +0800 Subject: [PATCH 52/54] chore(cspell): Update word lists --- cspell.config.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cspell.config.js b/cspell.config.js index daa8e5e7..7eda9bb7 100644 --- a/cspell.config.js +++ b/cspell.config.js @@ -36,7 +36,9 @@ export default { 'vmconfig', 'claycuy', 'creatordate', - 'nightlies' + 'nightlies', + 'dtolnay', + 'autostash' ], ignorePaths: [ 'node_modules/**', @@ -49,4 +51,4 @@ export default { 'ts/benchmarks/**/*', 'rust/benches/**/*', ], -}; +}; \ No newline at end of file From 0d0a5e2902e4a9fee1d0215536007186d1311e28 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Mon, 6 Jul 2026 13:00:25 +0800 Subject: [PATCH 53/54] chore(sync-deps): Update trigger --- .github/workflows/sync-deps.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/sync-deps.yml b/.github/workflows/sync-deps.yml index 792239c7..ab43971b 100644 --- a/.github/workflows/sync-deps.yml +++ b/.github/workflows/sync-deps.yml @@ -1,16 +1,18 @@ name: Sync Lock Files on: - push: - branches: [ main ] - pull_request: - branches: [ main ] + issue_comment: + types: [created] jobs: sync: + if: | + contains(github.event.comment.body, 'fix-lockfile') && + github.event.comment.user.login == 'claycuy' runs-on: ubuntu-latest permissions: contents: write + pull-requests: write steps: - uses: actions/checkout@v4 with: @@ -24,17 +26,14 @@ jobs: - name: Setup Rust uses: dtolnay/rust-toolchain@stable - # Sinkronisasi NPM - name: Sync package-lock.json run: | npm install --package-lock-only --ignore-scripts - # Sinkronisasi Cargo - name: Sync Cargo.lock run: | cargo generate-lockfile - # Commit kalau ada perubahan - name: Commit changes run: | git config --global user.name 'github-actions[bot]' @@ -46,6 +45,5 @@ jobs: git add package-lock.json Cargo.lock if ! git diff --cached --quiet; then git commit -m "chore: sync lock files" - # 5. Baru push git push origin HEAD:${GITHUB_HEAD_REF:-$GITHUB_REF_NAME} - fi + fi \ No newline at end of file From 121c6ed475ff533133b7d8d21bcb4538bd7714e0 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Mon, 6 Jul 2026 14:09:52 +0800 Subject: [PATCH 54/54] chore(sync-deps): Fix listening comment issue --- .github/workflows/sync-deps.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sync-deps.yml b/.github/workflows/sync-deps.yml index ab43971b..7cd0cad6 100644 --- a/.github/workflows/sync-deps.yml +++ b/.github/workflows/sync-deps.yml @@ -7,8 +7,9 @@ on: jobs: sync: if: | + github.event.issue.pull_request != null && contains(github.event.comment.body, 'fix-lockfile') && - github.event.comment.user.login == 'claycuy' + github.event.comment.user.login == 'claycuy' runs-on: ubuntu-latest permissions: contents: write