Skip to content

Commit e1c6087

Browse files
ZhiXiao-Linclaude
andcommitted
fix(node-sdk): bump package.json to 0.9.0; add version sync checks to justfile
- Fix sdk/node/package.json version 0.8.0 → 0.9.0 (was out of sync with Cargo.toml) - Add `just check-versions`: validates all 6 version files match core/Cargo.toml - Add `just bump-version VERSION`: atomically updates all version files at once - Update `just version`: now shows all 6 files side by side - Gate `just publish` behind `check-versions` so mismatches are caught before release Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ab83370 commit e1c6087

2 files changed

Lines changed: 96 additions & 3 deletions

File tree

justfile

Lines changed: 95 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,9 @@ publish:
420420
echo -e " ${DIM}a3s-code-core:${RESET} ${BOLD}${CORE_VERSION}${RESET}"
421421
echo ""
422422
423+
print_step "Checking version sync..."
424+
just check-versions || { print_error "Version mismatch. Run 'just bump-version <version>' to fix."; }
425+
423426
print_step "Checking formatting..."
424427
cargo fmt --all -- --check && print_success "Formatting OK" || print_error "Run 'just fmt' first."
425428
@@ -442,6 +445,96 @@ publish:
442445
publish-dry:
443446
cargo publish -p a3s-code-core --dry-run
444447

445-
# Show current version
448+
# Show current version of all packages
446449
version:
447-
@echo "a3s-code-core: $(grep '^version' core/Cargo.toml | head -1 | sed 's/.*\"\(.*\)\".*/\1/')"
450+
#!/usr/bin/env bash
451+
CANONICAL=$(grep '^version' core/Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
452+
echo "core/Cargo.toml ${CANONICAL}"
453+
echo "cli/Cargo.toml $(grep '^version' cli/Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')"
454+
echo "sdk/node/Cargo.toml $(grep '^version' sdk/node/Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')"
455+
echo "sdk/node/package.json $(grep '"version"' sdk/node/package.json | head -1 | sed 's/.*"\([0-9.]*\)".*/\1/')"
456+
echo "sdk/python/Cargo.toml $(grep '^version' sdk/python/Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')"
457+
echo "sdk/python/pyproject.toml $(grep '^version' sdk/python/pyproject.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')"
458+
459+
# Check all package version files are in sync with core/Cargo.toml
460+
check-versions:
461+
#!/usr/bin/env bash
462+
set -e
463+
464+
GREEN='\033[0;32m'
465+
RED='\033[0;31m'
466+
BOLD='\033[1m'
467+
DIM='\033[2m'
468+
RESET='\033[0m'
469+
470+
CANONICAL=$(grep '^version' core/Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
471+
472+
echo ""
473+
echo -e "${BOLD}Version sync check — canonical: ${CANONICAL}${RESET}"
474+
echo ""
475+
476+
FAIL=0
477+
check() {
478+
local label="$1"
479+
local actual="$2"
480+
if [ "$actual" = "$CANONICAL" ]; then
481+
echo -e " ${GREEN}${RESET} $(printf '%-35s' "$label") ${DIM}${actual}${RESET}"
482+
else
483+
echo -e " ${RED}${RESET} $(printf '%-35s' "$label") ${RED}${actual}${RESET} ← expected ${CANONICAL}"
484+
FAIL=1
485+
fi
486+
}
487+
488+
check "core/Cargo.toml" "$(grep '^version' core/Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')"
489+
check "cli/Cargo.toml" "$(grep '^version' cli/Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')"
490+
check "sdk/node/Cargo.toml" "$(grep '^version' sdk/node/Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')"
491+
check "sdk/node/package.json" "$(grep '"version"' sdk/node/package.json | head -1 | sed 's/.*"\([0-9.]*\)".*/\1/')"
492+
check "sdk/python/Cargo.toml" "$(grep '^version' sdk/python/Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')"
493+
check "sdk/python/pyproject.toml" "$(grep '^version' sdk/python/pyproject.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')"
494+
495+
echo ""
496+
if [ "$FAIL" -ne 0 ]; then
497+
echo -e " ${RED}${BOLD}Version mismatch detected. Run 'just bump-version <version>' to sync all files.${RESET}"
498+
echo ""
499+
exit 1
500+
else
501+
echo -e " ${GREEN}${BOLD}All versions in sync ✓${RESET}"
502+
echo ""
503+
fi
504+
505+
# Bump version across all package files atomically
506+
bump-version VERSION:
507+
#!/usr/bin/env bash
508+
set -e
509+
510+
GREEN='\033[0;32m'
511+
BOLD='\033[1m'
512+
DIM='\033[2m'
513+
RESET='\033[0m'
514+
515+
V="{{VERSION}}"
516+
517+
echo ""
518+
echo -e "${BOLD}Bumping all packages to ${V}${RESET}"
519+
echo ""
520+
521+
bump_toml() {
522+
local file="$1"
523+
sed -i.bak "s/^version = \".*\"/version = \"${V}\"/" "$file" && rm -f "${file}.bak"
524+
echo -e " ${GREEN}${RESET} ${DIM}${file}${RESET}"
525+
}
526+
bump_json() {
527+
local file="$1"
528+
sed -i.bak "s/\"version\": \".*\"/\"version\": \"${V}\"/" "$file" && rm -f "${file}.bak"
529+
echo -e " ${GREEN}${RESET} ${DIM}${file}${RESET}"
530+
}
531+
532+
bump_toml core/Cargo.toml
533+
bump_toml cli/Cargo.toml
534+
bump_toml sdk/node/Cargo.toml
535+
bump_json sdk/node/package.json
536+
bump_toml sdk/python/Cargo.toml
537+
bump_toml sdk/python/pyproject.toml
538+
539+
echo ""
540+
just check-versions

sdk/node/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@a3s-lab/code",
3-
"version": "0.8.0",
3+
"version": "0.9.0",
44
"description": "A3S Code - Native AI coding agent library for Node.js",
55
"main": "index.js",
66
"types": "index.d.ts",

0 commit comments

Comments
 (0)