Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
a6d00a8
chore: Added tests & typecheck step
claycuy Jul 2, 2026
057721c
chore: Added tests & typecheck step
claycuy Jul 2, 2026
a192932
chore: Fix package.json
claycuy Jul 2, 2026
db61662
fix: Unitry unit tests
claycuy Jul 3, 2026
2ea1dd3
chore: Update Cargo.toml
claycuy Jul 3, 2026
3a800da
Merge branch 'main' into chore/main
claycuy Jul 3, 2026
74ceca1
chore: Resolve lockfile conflict and sync
claycuy Jul 3, 2026
25a0da5
ci: Fix run typecheck & tests step
claycuy Jul 3, 2026
97d38f3
ci: Fix run typecheck & tests step
claycuy Jul 3, 2026
92bcae2
ci: Fix run typecheck & tests step
claycuy Jul 3, 2026
2c27f6c
ci: Upgrade build ci
claycuy Jul 3, 2026
81c1e43
chore: Delete comment in ci
claycuy Jul 3, 2026
5b7289e
ci: Refactor nightly build
claycuy Jul 3, 2026
2f1d53b
chore: Refactor checker ci
claycuy Jul 3, 2026
00a4ff5
chore: Refactor publish ci
claycuy Jul 4, 2026
4c1af00
fix(ci): Ci quality gate path
claycuy Jul 4, 2026
9855bc8
chore: Refactor production ci
claycuy Jul 4, 2026
2b8b3a5
chore: Refactor check tokens ci
claycuy Jul 4, 2026
2f04c2d
chore: Refactor stats ci
claycuy Jul 4, 2026
6b324b4
chore: Added sync-deps.yml
claycuy Jul 4, 2026
e99ae5c
fix(sync-deps): Sync NPM lockfile
claycuy Jul 4, 2026
69f52c5
fix(sync-deps): Commit changes
claycuy Jul 4, 2026
f5f62f5
fix(sync-deps): Permissions issue
claycuy Jul 4, 2026
1f9e423
fix(sync-deps): Commit refs issue
claycuy Jul 4, 2026
438d71f
fix(sync-deps): Commit refs issue
claycuy Jul 4, 2026
301abe5
fix(sync-deps): Commit refs issue
claycuy Jul 4, 2026
d93dded
fix(sync-deps): Unstaged changes issue
claycuy Jul 4, 2026
235b4bc
chore: sync lock files
github-actions[bot] Jul 4, 2026
0bcab79
chore: Added CREDITS.md
claycuy Jul 4, 2026
272b33f
chore: Refactor scripts
claycuy Jul 5, 2026
3c54903
fix(quality-gate): Run rust tests error
claycuy Jul 5, 2026
9f385bf
fix(scripts): Path error in test-ts.js
claycuy Jul 5, 2026
f30ae20
fix: Update .github/workflows/sync-deps.yml
claycuy Jul 5, 2026
70e4c4a
fix: Update .github/workflows/stats.yml
claycuy Jul 5, 2026
d159065
fix(scripts): Path error in ts-bench.js
claycuy Jul 5, 2026
56adf31
chore: Update cspell.config.js
claycuy Jul 5, 2026
00cae7e
fix(check-tokens): Create issue script extension
claycuy Jul 5, 2026
7781e91
fix(stats): Silent failure
claycuy Jul 5, 2026
97aca40
fix(stats): Env variables
claycuy Jul 5, 2026
72daad1
fix(publish): Env variables
claycuy Jul 5, 2026
62d4fb9
fix: Update .github/scripts/ci/deep_audit.sh
claycuy Jul 5, 2026
eb90396
fix(production): Rev parse issue
claycuy Jul 5, 2026
7f472c0
fix(production): Runtime arguments issue
claycuy Jul 5, 2026
7024fc4
chore: Update .lintstagedrc.js
claycuy Jul 5, 2026
a492c4e
fix: Update .github/scripts/production/validate_version_tag.sh
claycuy Jul 5, 2026
ecd2610
fix: Update .github/scripts/stats/fetch_update_gist.sh
claycuy Jul 5, 2026
3a1e4f8
chore: Added sync agents script
claycuy Jul 5, 2026
da2be3f
chore: Update solas.toml
claycuy Jul 6, 2026
726e0f1
chore: Update .gitattributes
claycuy Jul 6, 2026
dc6986a
chore: Update .lintstagedrc.js
claycuy Jul 6, 2026
f99dc56
chore: sync lock files
Jul 6, 2026
d1c5e26
test(core): Added unit tests
claycuy Jul 6, 2026
84ed9c4
chore(cspell): Update word lists
claycuy Jul 6, 2026
0d0a5e2
chore(sync-deps): Update trigger
claycuy Jul 6, 2026
121c6ed
chore(sync-deps): Fix listening comment issue
claycuy Jul 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .coderabbit.yml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 20 additions & 0 deletions .github/scripts/ci/deep_audit.sh
Original file line number Diff line number Diff line change
@@ -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 '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"
exit 1
fi
13 changes: 13 additions & 0 deletions .github/scripts/nightly/conmit_push.sh
Original file line number Diff line number Diff line change
@@ -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
38 changes: 38 additions & 0 deletions .github/scripts/nightly/create_release.sh
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions .github/scripts/nightly/filter_significant.sh
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions .github/scripts/nightly/generate_version.sh
Original file line number Diff line number Diff line change
@@ -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)"
11 changes: 11 additions & 0 deletions .github/scripts/nightly/production_workflow.sh
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions .github/scripts/nightly/update_files.sh
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions .github/scripts/production/create_release.sh
Original file line number Diff line number Diff line change
@@ -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
22 changes: 22 additions & 0 deletions .github/scripts/production/generate_release_notes.sh
Original file line number Diff line number Diff line change
@@ -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 -e "$NIGHTLIES\n$LAST_STABLE" | sort -V | sed -n "/$LAST_STABLE/,\$p" | grep -v "$LAST_STABLE")
else
FINAL_NIGHTLIES="$NIGHTLIES"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
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
15 changes: 15 additions & 0 deletions .github/scripts/production/validate_version_tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
VERSION="$1"
Comment thread
claycuy marked this conversation as resolved.
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
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
15 changes: 15 additions & 0 deletions .github/scripts/publish/build_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
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 $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 $TARGET
fi
5 changes: 5 additions & 0 deletions .github/scripts/publish/publish_crates.sh
Original file line number Diff line number Diff line change
@@ -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
Comment on lines +1 to +5

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== files ==\n'
git ls-files '.github/scripts/publish/publish_crates.sh' '.github/workflows/*' | sed 's#^`#-` #'

printf '\n== publish_crates.sh ==\n'
cat -n .github/scripts/publish/publish_crates.sh

printf '\n== workflow references ==\n'
rg -n '\.github/scripts/publish/publish_crates\.sh|version_override|CRATES_IO_TOKEN|cargo publish' .github/workflows .github/scripts -S

Repository: soteenstudio/lightvm

Length of output: 1899


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Map the script and any calling workflow files more precisely.
for f in $(git ls-files '.github/scripts/publish/publish_crates.sh' '.github/workflows/*'); do
  echo "== $f =="
  wc -l "$f"
done

echo
ast-grep outline .github/scripts/publish/publish_crates.sh --view expanded || true

Repository: soteenstudio/lightvm

Length of output: 1002


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '== .github/workflows/publish.yml (around the publish step) ==\n'
sed -n '180,220p' .github/workflows/publish.yml | cat -n

printf '\n== neighboring publish helper scripts ==\n'
for f in .github/scripts/publish/publish_npm.sh .github/scripts/publish/sync_assets_version.sh; do
  echo "--- $f ---"
  cat -n "$f"
done

Repository: soteenstudio/lightvm

Length of output: 7276


Pass the override and token through env:
${{ github.event.inputs.version_override }} and ${{ secrets.CRATES_IO_TOKEN }} are literal in this shell script, so the nightly check never matches and cargo publish --token gets a placeholder string. Pass both values from the workflow step’s env: block.

🧰 Tools
🪛 Shellcheck (0.11.0)

[error] 1-1: Parameter expansions can't start with {. Double check syntax.

(SC2296)


[info] 2-2: Double quote to prevent globbing and word splitting.

(SC2086)


[error] 2-2: Parameter expansions can't start with {. Double check syntax.

(SC2296)


[warning] 2-2: This } is literal. Check expression (missing ;/\n?) or quote it.

(SC1083)


[info] 4-4: Double quote to prevent globbing and word splitting.

(SC2086)


[error] 4-4: Parameter expansions can't start with {. Double check syntax.

(SC2296)


[warning] 4-4: This } is literal. Check expression (missing ;/\n?) or quote it.

(SC1083)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/scripts/publish/publish_crates.sh around lines 1 - 5, The
publish_crates.sh script is using GitHub expression placeholders directly inside
the shell logic, so the nightly branch check and cargo token value are not being
resolved at runtime. Update the workflow step to pass version_override and
CRATES_IO_TOKEN via env, then change the publish logic in publish_crates.sh to
read those environment variables instead of the raw GitHub expressions, keeping
the check in the script and the cargo publish command aligned with the
env-provided values.

Source: Linters/SAST tools

132 changes: 132 additions & 0 deletions .github/scripts/publish/publish_npm.sh
Original file line number Diff line number Diff line change
@@ -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}
Comment on lines +1 to +4

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '--- .github/scripts/publish/publish_npm.sh (first 160 lines) ---\n'
nl -ba .github/scripts/publish/publish_npm.sh | sed -n '1,160p'

printf '\n--- workflow references to publish_npm.sh ---\n'
rg -n "publish_npm\.sh|version_override|github\.event_name|github\.event\.release\.tag_name|github\.event\.inputs\.version_override" .github -S

Repository: soteenstudio/lightvm

Length of output: 249


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf -- '--- .github/scripts/publish/publish_npm.sh (first 160 lines) ---\n'
nl -ba .github/scripts/publish/publish_npm.sh | sed -n '1,160p'

printf -- '\n--- workflow references to publish_npm.sh ---\n'
rg -n "publish_npm\.sh|version_override|github\.event_name|github\.event\.release\.tag_name|github\.event\.inputs\.version_override" .github -S

Repository: soteenstudio/lightvm

Length of output: 263


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf -- '--- .github/scripts/publish/publish_npm.sh (first 160 lines) ---\n'
sed -n '1,160p' .github/scripts/publish/publish_npm.sh

printf -- '\n--- workflow references to publish_npm.sh ---\n'
rg -n "publish_npm\.sh|version_override|github\.event_name|github\.event\.release\.tag_name|github\.event\.inputs\.version_override" .github -S

printf -- '\n--- workflow files mentioning publish or npm ---\n'
rg -n "npm|publish" .github/workflows -S

Repository: soteenstudio/lightvm

Length of output: 9391


Move GitHub Actions expressions out of the shell script

$VERSION never gets a real value here because ${{ github.event.* }} is only expanded in the workflow YAML, not inside .github/scripts/publish/publish_npm.sh. As written, the script falls through with literal ${{ ... }} strings and the publish flow breaks. Pass these values through env: and read normal shell variables instead.

🧰 Tools
🪛 Shellcheck (0.11.0)

[error] 1-1: Parameter expansions can't start with {. Double check syntax.

(SC2296)


[error] 3-3: Parameter expansions can't start with {. Double check syntax.

(SC2296)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/scripts/publish/publish_npm.sh around lines 1 - 4, The VERSION
assignment in publish_npm.sh is using GitHub Actions expressions directly inside
the shell script, so the values are not expanded at runtime. Move the
github.event.inputs.version_override and github.event.release.tag_name lookups
into the workflow env and have the script read standard shell variables only,
then keep the RAW_VERSION/VERSION fallback logic in the script intact.

Source: Linters/SAST tools

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"
Comment on lines +21 to +23

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

file=".github/scripts/publish/publish_npm.sh"

echo "== file outline =="
wc -l "$file"
echo

echo "== relevant lines =="
nl -ba "$file" | sed -n '1,140p'
echo

echo "== search for prerelease/tag handling =="
rg -n "proto|alpha|beta|rc|nightly|npm publish|TAG=" "$file"

Repository: soteenstudio/lightvm

Length of output: 283


🏁 Script executed:

#!/bin/bash
set -euo pipefail

file=".github/scripts/publish/publish_npm.sh"

echo "== lines 1-40 =="
sed -n '1,40p' "$file" | cat -n
echo

echo "== lines 40-120 =="
sed -n '40,120p' "$file" | cat -n
echo

echo "== lines 120-131 =="
sed -n '120,131p' "$file" | cat -n
echo

echo "== prerelease-related matches =="
rg -n "proto|alpha|beta|rc|nightly|npm publish|TAG=" "$file"

Repository: soteenstudio/lightvm

Length of output: 6311


Treat nightly as a prerelease when selecting the npm dist-tag. The current regex leaves TAG="latest" for nightly builds, so both npm publish --tag $TAG paths will publish a nightly build under latest. Add nightly to the prerelease check.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/scripts/publish/publish_npm.sh around lines 21 - 23, The npm
dist-tag selection in publish_npm.sh is missing nightly builds from the
prerelease check, so nightly versions still get tagged as latest; update the TAG
assignment logic to treat VERSION values containing nightly the same as
proto/alpha/beta/rc so the publish path using npm publish --tag $TAG selects
next for nightly releases.


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%-*}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Map the relevant script and surrounding package metadata.
git ls-files .github/scripts/publish .github/scripts/publish/publish_npm.sh package.json .npmrc .github/workflows || true

echo '--- publish_npm.sh (outline if available) ---'
if command -v ast-grep >/dev/null 2>&1; then
  ast-grep outline .github/scripts/publish/publish_npm.sh --view expanded || true
fi

echo '--- publish_npm.sh lines 1-220 ---'
nl -ba .github/scripts/publish/publish_npm.sh | sed -n '1,220p'

echo '--- search for PLATFORM / OS_VAL / libc / musl / wasm ---'
rg -n 'PLATFORM|OS_VAL|libc|musl|wasm|process\.platform|os:' .github/scripts/publish .github/workflows package.json .npmrc || true

Repository: soteenstudio/lightvm

Length of output: 854


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect package manifest conventions for optional dependencies and platform tags.
rg -n '"os"|\"libc\"|optionalDependencies|cpu|os|libc' --glob 'package*.json' --glob '*.json' .

Repository: soteenstudio/lightvm

Length of output: 276


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- publish_npm.sh ---'
sed -n '1,220p' .github/scripts/publish/publish_npm.sh | cat -n

echo '--- relevant search ---'
rg -n 'PLATFORM|OS_VAL|LIBC|libc|musl|wasm|os:|cpu:|optionalDependencies|process\.platform' .github/scripts/publish .github/workflows package.json .

echo '--- package manifests ---'
git ls-files '**/package.json' '**/package-lock.json' '**/npm-shrinkwrap.json' '**/pnpm-lock.yaml' '**/yarn.lock' | sed -n '1,200p'

Repository: soteenstudio/lightvm

Length of output: 21551


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- publish_npm.sh (focused) ---'
sed -n '1,140p' .github/scripts/publish/publish_npm.sh | cat -n

echo '--- search platform tag names in repo ---'
rg -n 'linux-musl|browser-wasm|darwin|linux|win32|process\.platform|libc' .github/scripts .github/workflows package.json .

Repository: soteenstudio/lightvm

Length of output: 17569


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Read the publish script with line numbers and find platform/package naming conventions.
sed -n '1,220p' .github/scripts/publish/publish_npm.sh | cat -n

echo '--- platform-specific package metadata ---'
rg -n --fixed-strings 'linux-musl' .
rg -n --fixed-strings 'browser-wasm' .
rg -n --fixed-strings '"os"' .
rg -n --fixed-strings '"libc"' .
rg -n --fixed-strings '"cpu"' .

Repository: soteenstudio/lightvm

Length of output: 8521


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Focus on the publish script and any package manifests that declare os/libc/cpu.
sed -n '1,180p' .github/scripts/publish/publish_npm.sh | cat -n

echo '--- package.json ---'
sed -n '1,240p' package.json | cat -n

echo '--- files mentioning os/libc/cpu in package manifests ---'
find . -name package.json -o -name package-lock.json -o -name npm-shrinkwrap.json | while read -r f; do
  if rg -n --fixed-strings '"os"' "$f" >/dev/null || rg -n --fixed-strings '"libc"' "$f" >/dev/null || rg -n --fixed-strings '"cpu"' "$f" >/dev/null; then
    echo "### $f"
    rg -n --fixed-strings '"os"' "$f" || true
    rg -n --fixed-strings '"libc"' "$f" || true
    rg -n --fixed-strings '"cpu"' "$f" || true
  fi
done

Repository: soteenstudio/lightvm

Length of output: 10467


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Show the exact publish_npm.sh content and any JSON package fields relevant to optional dependency filtering.
sed -n '1,220p' .github/scripts/publish/publish_npm.sh | cat -n

echo '--- manifest field search ---'
python3 - <<'PY'
from pathlib import Path
import json

for path in Path('.').rglob('package.json'):
    try:
        data = json.loads(path.read_text())
    except Exception:
        continue
    fields = {k: data.get(k) for k in ('name', 'version', 'os', 'cpu', 'libc', 'optionalDependencies') if k in data}
    if fields:
        print(f'### {path}')
        for k, v in fields.items():
            print(k, '=>', v)
PY

Repository: soteenstudio/lightvm

Length of output: 32259


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- publish_npm.sh around line 46 ---'
sed -n '1,90p' .github/scripts/publish/publish_npm.sh | cat -n

echo '--- package manifests with os/libc/cpu fields ---'
python3 - <<'PY'
from pathlib import Path
import json

for path in Path('.').rglob('package.json'):
    try:
        data = json.loads(path.read_text())
    except Exception:
        continue
    keys = [k for k in ('os', 'cpu', 'libc', 'optionalDependencies', 'name') if k in data]
    if keys:
        print(f'### {path}')
        for k in keys:
            print(f'{k}: {data[k]}')
PY

Repository: soteenstudio/lightvm

Length of output: 24933


Use valid platform filters for these packages
linux-musl-* should publish with os: ["linux"] plus libc: ["musl"], and browser-wasm should not be filtered with Node os/cpu values. OS_VAL="${PLATFORM%-*}" turns them into linux-musl and browser, so npm skips those optional deps.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/scripts/publish/publish_npm.sh at line 46, The platform parsing in
publish_npm.sh is too coarse: OS_VAL="${PLATFORM%-*}" turns linux-musl-* into
linux-musl and browser-wasm into browser, which causes invalid npm package
filters. Update the publish logic to derive package metadata from the PLATFORM
value in a way that preserves valid npm constraints for linux-musl-* (os plus
libc) and avoids applying Node os/cpu filters to browser-wasm, using the
relevant publish path and PLATFORM handling in publish_npm.sh.

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
Loading
Loading