Repository navigation
Sync the getting-started toolchain with Wechaty 2 - #328
Conversation
Node 26 runs the TypeScript examples directly. Biome and a local TypeScript 7 config replace the Chatie ESLint and tsconfig packages, and the smoke tests use node:test. The fingerpose, codesandbox, chatgpt, hot-import, and monster examples are removed. Co-authored-by: Huan Li <huan@chatie.io>
PR SummaryMedium Risk Reviewed by Cursor Bugbot for commit 8c9f2d2. Bugbot is set up for automated code reviews on this repo. Configure here. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 987a13a260
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| function errorDetail (e: unknown): string { | ||
| if (e instanceof Error) { | ||
| return errorDetail(e) ?? e.message |
There was a problem hiding this comment.
Return the error details instead of recursing on the same error
Whenever a room operation throws an Error, this helper calls itself with the identical argument indefinitely and throws RangeError: Maximum call stack size exceeded; the e.message fallback is never reached. Multiple catch handlers now use this helper, so failures in room lookup, membership changes, or topic updates produce another exception instead of logging the original failure. Return e.stack ?? e.message rather than calling errorDetail(e) again.
Useful? React with 👍 / 👎.
| "test": "npm-run-all lint test:smoke", | ||
| "test:smoke": "cross-env NODE_OPTIONS=\"--no-warnings --loader=ts-node/esm\" tap --timeout=150 \"tests/**/*.spec.ts\"" | ||
| "test": "npm run lint && npm run test:smoke", | ||
| "test:smoke": "node --test --test-force-exit --test-timeout=180000 tests", |
There was a problem hiding this comment.
Pass a test-file glob instead of the tests directory
The trailing tests argument is treated as a test entry point rather than recursively discovering the directory's test files. Running npm run test:smoke locally on Node 24.15.0 fails with Cannot find module '/workspace/getting-started/tests' before executing any smoke tests. The target Node 26 documentation specifies that “one or more glob patterns can be provided as the final argument(s).” Use an explicitly quoted tests/*.test.ts glob, or omit the positional argument to use automatic discovery; otherwise npm test and the Node CI job cannot run the migrated suite.
Useful? React with 👍 / 👎.
| log.info('Bot', '(message) %s', msg) | ||
|
|
||
| const filehelper = bot.Contact.load('filehelper') | ||
| const filehelper = impls.ContactImpl.load('filehelper') |
There was a problem hiding this comment.
Resolve contacts through the bot-bound Contact class
On every incoming message, this now calls load() on the unbound implementation class rather than the bot's Contact class. load() constructs a contact, and Wechaty's wechatify constructor guard rejects implementation classes that have not been bound to a bot, so the handler throws before processing any busy-mode commands or automatic replies. The same replacement also breaks friendship handling in examples/advanced/friend-bot.ts and the fcontact command in examples/advanced/self-testing-bot.ts. Use await bot.Contact.find({ id: 'filehelper' }) with an appropriate missing-contact check, and resolve the forwarding contact through its bot as well.
Useful? React with 👍 / 👎.
ContactImpl.load() builds an unbound contact, which Wechaty rejects. The busy, friend, and self-testing examples now use bot.Contact.find(). The room-bot error helper returned another call to itself, so a caught Error never reached its stack or message. Co-authored-by: Huan Li <huan@chatie.io>
…echaty-2-toolchain-d406 # Conflicts: # .github/workflows/node.js.yml # README.md # examples/basic/ding-dong-bot.ts # examples/third-parties/maodou/maodou-classes-bot.ts # examples/third-parties/maodou/maodou-course-api.ts # examples/third-parties/maodou/maodou-nlp.ts # examples/third-parties/maodou/package.json # examples/third-parties/xiaoli/package.json # examples/third-parties/xiaoli/xiaoli-news-bot.ts # examples/tutorials/google-cloud-shell-tutorial.md # package.json # tests/wechaty-puppet-service.test.ts # tests/wechaty-puppet-wechat.test.ts # tsconfig.json Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e737931. Configure here.
|
@cursor read review comments and ship fixes |
|
The review comments are fixed on #328.
I’m waiting on CI for this commit. |
Ignore a Neo login rejection after the QR code is shown, so node:test does not fail CI when nobody scans. Filehelper lookups no longer skip the rest of the busy and friend handlers. Typecheck covers the nested examples, and the Deno job can load the Puppet Neo addon. Co-authored-by: Huan Li <huan@chatie.io>
Node's test runner treats a directory argument as one entry point on some releases. Quote tests/*.test.ts so the runner expands the smoke tests itself. Co-authored-by: Huan Li <huan@chatie.io>




I'm submitting a...
Checklist
Description
Bring this repository onto the Wechaty 2 toolchain. The bot examples stay on
wechaty^1.20.2.@chatie/tsconfigwith a local TypeScript 7 config (NodeNext, type stripping,erasableSyntaxOnly).npm run lint:tsis the typecheck.npm run lintis Biome, then the typecheck..tsfiles directly, with nots-nodeloader. Entry points and the smoke tests have a#!/usr/bin/env nodeshebang.node:test(tests/*.test.ts).npm testlints, then runs them with--test-force-exit..devcontainer/with the Wechaty devcontainer (Ubuntu 24.04, Node 26, Deno). Codespaces still opensexamples/ding-dong-bot.ts.npm install.package-lock.jsongitignored on purpose.DEVELOPMENT.mdrecords why: a lockfile would hide a broken range until a new user installed the repo.examples/third-parties/maodouandxiaolistay, now as ESM TypeScript with their ownpackage.json. Roottscdoes not include them.Does this PR introduce a breaking change?
npm startand the examples now require Node.js 26.ts-nodeand the JavaScript entry points are gone. The removed example directories are no longer in the tree.fix #327