Skip to content

feat(scripts): add build prerequisite preflight check - #1896

Open
legenddcr wants to merge 1 commit into
GCWing:mainfrom
legenddcr:chore/cherry-pick-build-prereq-check
Open

feat(scripts): add build prerequisite preflight check#1896
legenddcr wants to merge 1 commit into
GCWing:mainfrom
legenddcr:chore/cherry-pick-build-prereq-check

Conversation

@legenddcr

Copy link
Copy Markdown
Contributor

Summary

Cherry-pick AtomGit OpenBitFun/bitfun_agent_kernel#5 into the current GitHub repository.

The preflight check improves contributor feedback by detecting missing build prerequisites before pnpm or Cargo reports less actionable failures.

Changes

  • add pnpm run check:build-prereqs
  • detect missing root node_modules and src/mobile-web/dist
  • warn when sherpa-onnx needs a first-build download and no local cache is available
  • support --fix for the two deterministic pnpm prerequisites
  • add six focused Node tests
  • document the workflow in English and Chinese contributor guides and the verification matrix

Verification

  • node --check scripts/check-build-prereqs.mjs
  • node --check scripts/check-build-prereqs.test.mjs
  • node --test scripts/check-build-prereqs.test.mjs (6 passed)
  • pnpm run check:build-prereqs
  • pnpm run check:repo-hygiene
  • git diff --check origin/main...HEAD

Notes

  • AI-assisted review and cherry-pick.
  • Testing level: focused tests fully passed.
  • Existing unrelated untracked local files were not included.

Add scripts/check-build-prereqs.mjs to detect missing build prerequisites
that cause confusing cargo/pnpm failures:

- Root node_modules missing (fix: pnpm install)
- src/mobile-web/dist missing (fix: pnpm run prepare:mobile-web) —
  the bitfun-desktop Tauri build script references this as a resource
- sherpa-onnx prebuilt cache missing — warns only for first-build scenario;
  when target/sherpa-onnx-prebuilt/<version>/lib/ exists, build.rs auto-detects
  it and no env var is needed

The check supports --fix to auto-run fixable commands and re-verifies
after fix. Hook:
  pnpm run check:build-prereqs
  pnpm run check:build-prereqs -- --fix

Includes 6 unit tests covering pass/fail/warn/mixed/--fix paths.
Updates CONTRIBUTING.md, CONTRIBUTING_CN.md, and AGENTS.md
verification table.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant