You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wechaty 2.0 on wechaty/wechatymain (2.0.0-alpha.18) is the source of truth. This is a review plan only. No branch, commits, or pull request until you approve.
The SDK dependency stays on wechaty^1.20.2. This pass changes how the repo is linted, typechecked, and tested. It does not move the tutorial onto the 2.0 alpha API. Coverage baselines, the npm and Docker publish workflows, and the release-branch version-bump hook stay in wechaty/wechaty. Gitpod stays as it is.
1. Local TypeScript config
Remove @chatie/tsconfig. Replace the root tsconfig.jsonextends with the compiler options from Wechaty 2.0:
outDir stays dist. include becomes the files that actually exist: examples/**/*.ts and tests/**/*.test.ts. There are no local enums, namespaces, or constructor parameter properties, so erasableSyntaxOnly should pass. verbatimModuleSyntax may still require import type fixes. npm run build remains tsc.
TypeScript moves from ~5.9.3 to the same @typescript/native alias Wechaty uses (typescript@^7). The overrides.typescript pin goes away. A second script, lint:ts (tsc --isolatedModules --noEmit), is the typecheck. Node’s type stripping does not check types.
Two nested packages still extend @chatie/tsconfig: examples/tensorflow.js/fingerpose and examples/third-parties/codesandbox. Same local config there, in this change, so the repo no longer installs that package.
2. tstest to node:test
The four smoke tests import test from tstest and the script runs them with tap. Neither tstest nor tap is a direct dependency. tstest is the Chatie runner this replaces.
Rename tests/*.spec.ts to tests/*.test.ts. Each file imports test from node:test and assertions from node:assert/strict. t.pass becomes assert.ok. t.teardown becomes t.after. The skip option on the puppet-service test stays. Shebangs become #!/usr/bin/env node.
test:smoke becomes node --test --test-force-exit --test-timeout=180000 tests. --test-force-exit replaces the process.exit(0) workaround that existed so tap would not hang on open sockets. The timeout matches Wechaty’s integration tests and covers the 100–120 second scan waits.
npm test becomes npm run lint && npm run test:smoke. npm-run-all can go.
3. Deno test
Add the same experimental Deno path Wechaty uses. Deno 2.9.8, continue-on-error: true, so a Deno failure does not fail the workflow.
Smoke tests need a wider permission set than Wechaty’s unit tests: network, environment, read/write, and spawning Chrome for the web puppet. The script will be test:unit:deno, with NODE_BINARY set the same way, plus --allow-net and --allow-run. lint:ts stays the typecheck. Deno runs with --no-check.
If Puppeteer cannot start under Deno, the Deno script narrows to tests/wechaty-puppet-mock.test.ts and the browser puppets stay Node-only. The CI job still exists either way.
4. ESLint to Biome
Remove @chatie/eslint-config, .eslintrc.cjs, and the eslint.validate VS Code setting.
Add @biomejs/biome^2.6.5 and copy biome.json: schema 2.6.5, formatter off, assist off, linter preset none, only the correctness and suspicious rules Wechaty enables. That avoids a format-only diff. lint:biome is biome lint examples tests. lint is lint:biome then lint:ts.
5. Devcontainer
Replace .devcontainer/ with the Wechaty directory:
One addition for this repo: customizations.codespaces.openFiles keeps opening examples/ding-dong-bot.ts. The current universal image and the global cross-env install go away.
6. Runner, lockfile, and scripts
These match DEVELOPMENT.md and fit this repo.
Engines become node >= 26, npm >= 10. CI stays on macOS, Windows, and Ubuntu, with Node 26 only. The weekly cron stays so puppet drift is still caught. Install becomes npm ci once a lockfile exists. Actions can stay on the current v7 checkout and setup-node.
Stop ignoring package-lock.json, generate it, and commit it. npm run start and cqrs become node examples/.../*.ts with no ts-node loader. Shebangs on examples/ding-dong-bot.ts, examples/cqrs/ding-dong-bot.ts, examples/advanced/dump-room-member.ts, and examples/professional/speech-to-text-bot.ts match. README and examples/tutorials/google-cloud-shell-tutorial.md drop the npx ts-node lines.
Remove ts-node, @chatie/git-scripts, and check-node-version. engines covers the Node check. The pre-push hook becomes a small scripts/pre-push.ts that runs npm run lint only. Puppet smoke tests need network and tokens, so they stay out of the hook. Wechaty’s version-bump hook is not copied.
cross-env is used by start:* and is not declared. Add it as a dependency so the Windows CI scripts keep working.
Makefile: lint is a real recipe (npm run lint). clean gets a clean script (shx rm -fr dist) or the target is dropped. Today clean calls a script that does not exist, and lint is parsed as dependencies named npm, run, and lint.
Nested examples/professional/chatgpt-bot and examples/third-parties/codesandbox still start via ts-node. Update those start scripts to node in the same change. Their own dependency trees stay on Wechaty 1.x.
Risks
Node 26 is what Wechaty 2.0 runs. These smoke tests still launch Wechaty 1.20 puppets, including an old Puppeteer. The web puppet already has a macOS arm64 skip. The first CI run is the compatibility check.
verbatimModuleSyntax and TypeScript 7 can fail on default imports from qrcode-terminal and puppet packages. Those are fixed in the example sources until npm run lint:ts is clean.
Deno plus Puppeteer may not get past startup. The job is experimental and does not block the workflow.
The copied devcontainer is the full Wechaty image (Rust, Java, TeX, agent CLIs, home-directory mounts), which is heavier than the current Codespaces universal image.
Approval needed before any edit
Node 26 and TypeScript 7 while dependencies stay on Wechaty 1.20.
Copy the full .devcontainer, with only the Codespaces open-file added.
Deno smoke job with continue-on-error, narrowed to the mock puppet if Chrome will not start.
Include the fingerpose, codesandbox, and chatgpt-bot packages in this change.
Commit package-lock.json and switch CI to npm ci.
Say which of those you want changed, and I will implement on a branch and open the PR after that.
remove the fingerpose, codesandbox, and chatgpt-bot packages in this change.
do not commit package-lock.json - make it deliberate be ignored, put it in DEVELOPMENT.md - because we want to catch errors earlier in this getting started repo if there's any version issues.
make all source code files in .ts and writes in TypeScript - make sure Node can run ts directly.
Add shebang to unit tests .ts files so that they can be run directly.
Updated plan for review. No branch, no commits, and no pull request until you approve.
Wechaty 2.0 on wechaty/wechatymain (2.0.0-alpha.18) is still the toolchain source. The SDK dependency stays on wechaty^1.20.2. This pass changes how the repo is linted, typechecked, tested, and how examples are written. It does not move the tutorial onto the 2.0 alpha API. Coverage baselines, the npm and Docker publish workflows, and the release-branch version-bump hook stay in wechaty/wechaty. Gitpod stays as it is.
What changed from the last plan
Delete the three nested packages: examples/tensorflow.js/fingerpose, examples/third-parties/codesandbox, and examples/professional/chatgpt-bot. examples/tensorflow.js/ goes with fingerpose, because that package is the only thing in it. Their @chatie/tsconfig files go with them. The chatgpt-botdotenv file only has empty keys.
package-lock.json stays gitignored. It is already ignored. CI keeps npm install and package-manager-cache: false. A new root DEVELOPMENT.md records why: a lockfile would hide range conflicts, and this repo should fail on npm install when a range breaks, before a new user hits it. Wechaty itself still commits its lockfile. This repo does not.
Every remaining source file is TypeScript. The 31 .js sources outside those three packages are renamed to .ts, given types, and written so Node 26 runs them with built-in type stripping. ts-node and the --loader=ts-node/esm shebangs go away. examples/README.md drops the “vanilla JavaScript” contribution note.
The four smoke tests are renamed to tests/*.test.ts, get #!/usr/bin/env node, and the executable bit, so ./tests/wechaty-puppet-mock.test.ts runs that file directly.
1. Local TypeScript config
Remove @chatie/tsconfig. Replace the root tsconfig.jsonextends with the compiler options from Wechaty 2.0:
outDir stays dist. include is examples/**/*.ts and tests/**/*.test.ts, excluding examples/third-parties/**. examples/third-parties/maodou and examples/third-parties/xiaoli stay in the repo and become TypeScript, but they keep their own package.json and their own dependencies (bosonnlp, node-schedule, node-fetch, recognizers, Wechaty 0.x ranges). Those modules are not installed by the root npm install, so root tsc does not include them. Each gets "type": "module" and scripts that call node on the .ts file.
TypeScript moves from ~5.9.3 to the @typescript/native alias Wechaty uses (typescript@^7). The overrides.typescript pin goes away. npm run build remains tsc. lint:ts is tsc --isolatedModules --noEmit. Node’s type stripping does not check types.
2. All sources are TypeScript, and Node runs them
Node 26 runs .ts directly. Scripts and shebangs call node, with no loader.
Entry points that you run get #!/usr/bin/env node and the executable bit. That set is the existing bot and CLI entry points, including examples/ding-dong-bot.ts, examples/cqrs/ding-dong-bot.ts, examples/advanced/dump-room-member.ts, and examples/professional/speech-to-text-bot.ts, plus the .js bots that already had a shebang (busy-bot, room-bot, room-say-cli, maodou, xiaoli) and the other bot entry points that are started with node. Imported modules (listeners, config, gist-bot handlers) are TypeScript and have no shebang.
Conversion rules, checked by lint:ts:
ESM only. module.exports in gist-bot handlers, hot-import listeners, and maodou helpers becomes export.
Relative imports use a .ts extension, including gist-bot’s current ./on-message.js and maodou’s ./maodou-course-api.js.
Parameters and values get types from wechaty 1.20 (Message, Contact, ScanStatus, and the rest). import type where verbatimModuleSyntax requires it.
No new enums, namespaces, or constructor parameter properties.
Wechaty.instance() stays where the 1.20 types still export it. A call changes only when lint:ts rejects it, and then it becomes WechatyBuilder.build().
package.json scripts:
start and cqrs become node examples/ding-dong-bot.ts and node examples/cqrs/ding-dong-bot.ts.
start:js is removed. There is no JavaScript entry left. examples/basic/ding-dong-bot.ts stays as the short basic example. The root examples/ding-dong-bot.ts stays the npm start bot.
start:* keeps cross-env for the Windows CI matrix. cross-env is added as a dependency. It is used today and not declared.
README, examples/tutorials/google-cloud-shell-tutorial.md, examples/README.md, examples/professional/blessed-twins-bot/README.md, and the monster-bot and hot-import docs and shell scripts drop npx ts-node and .js paths. The bug-report template’s node yourbot.js becomes node yourbot.ts. Its rm -rf package-lock.json line stays, and it matches this policy.
Hot import is the one behavior risk. hot-import-bot and monster-bot pass string paths such as './listeners/on-message' to bot.on, and hot-import loads those as JavaScript. The listeners become .ts, and the strings gain the .ts suffix. If hot-import cannot load a .ts file under Node 26, those two examples switch to a normal typed import (import { onMessage } from './listeners/on-message.ts') so node can run them. Listener hot reload would then be gone. I will report which way it landed.
3. tstest to node:test
The four smoke tests import test from tstest, and the script runs them with tap. Neither tstest nor tap is a direct dependency.
Rename tests/*.spec.ts to tests/*.test.ts. Each file imports test from node:test and assertions from node:assert/strict. t.pass becomes assert.ok. t.teardown becomes t.after. The skip option on the puppet-service test stays.
Shebang on each test file:
#!/usr/bin/env node
Git mode 100755, so this works:
./tests/wechaty-puppet-mock.test.ts
test:smoke becomes node --test --test-force-exit --test-timeout=180000 tests. --test-force-exit replaces the process.exit(0) workaround that existed so tap would not hang on open sockets. The timeout matches Wechaty’s integration tests and covers the 100–120 second scan waits.
npm test becomes npm run lint && npm run test:smoke. npm-run-all goes.
4. Deno test
Same experimental Deno path as Wechaty. Deno 2.9.8, continue-on-error: true, so a Deno failure does not fail the workflow.
Smoke tests need a wider permission set than Wechaty’s unit tests: network, environment, read/write, and spawning Chrome for the web puppet. The script is test:unit:deno, with NODE_BINARY set the same way, plus --allow-net and --allow-run. lint:ts stays the typecheck. Deno runs with --no-check.
If Puppeteer cannot start under Deno, the Deno script narrows to tests/wechaty-puppet-mock.test.ts and the browser puppets stay Node-only. The CI job still exists either way.
5. ESLint to Biome
Remove @chatie/eslint-config, .eslintrc.cjs, and the eslint.validate VS Code setting.
Add @biomejs/biome^2.6.5 and copy biome.json: schema 2.6.5, formatter off, assist off, linter preset none, only the correctness and suspicious rules Wechaty enables. That avoids a format-only diff. lint:biome is biome lint examples tests. lint is lint:biome then lint:ts.
6. Devcontainer
Replace .devcontainer/ with the Wechaty directory:
One addition for this repo: customizations.codespaces.openFiles keeps opening examples/ding-dong-bot.ts. The current universal image and the global cross-env install go away.
7. Runner, lockfile, and DEVELOPMENT.md
Engines become node >= 26, npm >= 10. CI stays on macOS, Windows, and Ubuntu, with Node 26 only. The weekly cron stays. Install stays npm install. The workflow comment points at DEVELOPMENT.md for the ignored lockfile. Actions stay on the current v7 checkout and setup-node.
.gitignore keeps package-lock.json. A generated lockfile is not committed.
New DEVELOPMENT.md covers three things: Node 26 runs the .ts sources directly, and lint:ts is the typecheck. package-lock.json is ignored on purpose so a broken range fails in this repo on a fresh npm install. Tests are node:test, with the direct shebang command, and the Deno job is experimental.
Remove ts-node, @chatie/git-scripts, and check-node-version. engines covers the Node check. The pre-push hook becomes a small scripts/pre-push.ts that runs npm run lint only. Puppet smoke tests need network and tokens, so they stay out of the hook. Wechaty’s version-bump hook is not copied.
Makefile: lint becomes a real recipe (npm run lint). clean gets a clean script (shx rm -fr dist) or the target is dropped. Today clean calls a script that does not exist, and lint is parsed as dependencies named npm, run, and lint.
Risks
Node 26 is what Wechaty 2.0 runs. These smoke tests still launch Wechaty 1.20 puppets, including an old Puppeteer. The web puppet already has a macOS arm64 skip. The first CI run is the compatibility check.
verbatimModuleSyntax and TypeScript 7 can fail on default imports from qrcode-terminal and puppet packages, and on the old Wechaty.instance() examples. Those are fixed in the sources until npm run lint:ts is clean.
hot-import may be unable to load .ts listeners. The fallback is a static import, and those two examples would no longer hot-reload.
maodou and xiaoli typecheck only inside their own directories. Root npm test does not install them.
Deno plus Puppeteer may not get past startup. The job is experimental and does not block the workflow.
The copied devcontainer is the full Wechaty image (Rust, Java, TeX, agent CLIs, home-directory mounts), which is heavier than the current Codespaces universal image.
Still needs your approval
Node 26 and TypeScript 7, with dependencies staying on Wechaty 1.20.
Copy the full .devcontainer, with only the Codespaces open-file added.
Deno smoke job with continue-on-error, narrowed to the mock puppet if Chrome will not start.
Delete fingerpose, codesandbox, and chatgpt-bot. Keep maodou and xiaoli as standalone TypeScript packages, outside root tsc.
Leave package-lock.json gitignored and explain that in DEVELOPMENT.md. CI stays on npm install.
Convert every remaining .js source to TypeScript, and put #!/usr/bin/env node on tests and on bot entry points.
Say which of those you want changed. I will implement on a branch and open the PR after that.
Thanks. Glad the toolchain update landed the way you wanted.
#328 is merged into main. It brings this repo onto the Wechaty 2 toolchain: local TypeScript config, Biome, node:test, the Deno job, the new devcontainer, and TypeScript examples that Node 26 runs directly. The fingerpose, codesandbox, chatgpt-bot, hot-import-bot, and monster-bot examples are gone, and package-lock.json stays ignored on purpose.
Activity
huan commentedon Nov 23, 2026
@cursor only analyze and show plan for my review, do not create PR before my approval
cursor commentedon Nov 23, 2026
Wechaty 2.0 on
wechaty/wechatymain(2.0.0-alpha.18) is the source of truth. This is a review plan only. No branch, commits, or pull request until you approve.The SDK dependency stays on
wechaty^1.20.2. This pass changes how the repo is linted, typechecked, and tested. It does not move the tutorial onto the 2.0 alpha API. Coverage baselines, the npm and Docker publish workflows, and the release-branch version-bump hook stay inwechaty/wechaty. Gitpod stays as it is.1. Local TypeScript config
Remove
@chatie/tsconfig. Replace the roottsconfig.jsonextendswith the compiler options from Wechaty 2.0:moduleandmoduleResolution:NodeNexttarget:esnextverbatimModuleSyntax,erasableSyntaxOnly,isolatedModules,rewriteRelativeImportExtensionsstrictplusnoUncheckedIndexedAccess,noImplicitOverride,noPropertyAccessFromIndexSignaturedeclaration,declarationMap,sourceMap,skipLibCheckoutDirstaysdist.includebecomes the files that actually exist:examples/**/*.tsandtests/**/*.test.ts. There are no local enums, namespaces, or constructor parameter properties, soerasableSyntaxOnlyshould pass.verbatimModuleSyntaxmay still requireimport typefixes.npm run buildremainstsc.TypeScript moves from
~5.9.3to the same@typescript/nativealias Wechaty uses (typescript@^7). Theoverrides.typescriptpin goes away. A second script,lint:ts(tsc --isolatedModules --noEmit), is the typecheck. Node’s type stripping does not check types.Two nested packages still extend
@chatie/tsconfig:examples/tensorflow.js/fingerposeandexamples/third-parties/codesandbox. Same local config there, in this change, so the repo no longer installs that package.2.
tstesttonode:testThe four smoke tests import
testfromtstestand the script runs them withtap. Neithertstestnortapis a direct dependency.tstestis the Chatie runner this replaces.Rename
tests/*.spec.tstotests/*.test.ts. Each file importstestfromnode:testand assertions fromnode:assert/strict.t.passbecomesassert.ok.t.teardownbecomest.after. Theskipoption on the puppet-service test stays. Shebangs become#!/usr/bin/env node.test:smokebecomesnode --test --test-force-exit --test-timeout=180000 tests.--test-force-exitreplaces theprocess.exit(0)workaround that existed so tap would not hang on open sockets. The timeout matches Wechaty’s integration tests and covers the 100–120 second scan waits.npm testbecomesnpm run lint && npm run test:smoke.npm-run-allcan go.3. Deno test
Add the same experimental Deno path Wechaty uses. Deno 2.9.8,
continue-on-error: true, so a Deno failure does not fail the workflow.Smoke tests need a wider permission set than Wechaty’s unit tests: network, environment, read/write, and spawning Chrome for the web puppet. The script will be
test:unit:deno, withNODE_BINARYset the same way, plus--allow-netand--allow-run.lint:tsstays the typecheck. Deno runs with--no-check.If Puppeteer cannot start under Deno, the Deno script narrows to
tests/wechaty-puppet-mock.test.tsand the browser puppets stay Node-only. The CI job still exists either way.4. ESLint to Biome
Remove
@chatie/eslint-config,.eslintrc.cjs, and theeslint.validateVS Code setting.Add
@biomejs/biome^2.6.5and copybiome.json: schema 2.6.5, formatter off, assist off, linter presetnone, only thecorrectnessandsuspiciousrules Wechaty enables. That avoids a format-only diff.lint:biomeisbiome lint examples tests.lintislint:biomethenlint:ts.5. Devcontainer
Replace
.devcontainer/with the Wechaty directory:devcontainer.json— Ubuntu 24.04 base, Node 26, Deno, the feature set, Claude/Codex/Gemini/gitconfig mounts,postCreateCommand:npm installfeatures/any-packages/features/gh-auto-auth/devcontainer-lock.jsonif presentOne addition for this repo:
customizations.codespaces.openFileskeeps openingexamples/ding-dong-bot.ts. The current universal image and the globalcross-envinstall go away.6. Runner, lockfile, and scripts
These match
DEVELOPMENT.mdand fit this repo.node >= 26,npm >= 10. CI stays on macOS, Windows, and Ubuntu, with Node 26 only. The weekly cron stays so puppet drift is still caught. Install becomesnpm cionce a lockfile exists. Actions can stay on the current v7 checkout and setup-node.package-lock.json, generate it, and commit it.npm run startandcqrsbecomenode examples/.../*.tswith nots-nodeloader. Shebangs onexamples/ding-dong-bot.ts,examples/cqrs/ding-dong-bot.ts,examples/advanced/dump-room-member.ts, andexamples/professional/speech-to-text-bot.tsmatch. README andexamples/tutorials/google-cloud-shell-tutorial.mddrop thenpx ts-nodelines.ts-node,@chatie/git-scripts, andcheck-node-version.enginescovers the Node check. The pre-push hook becomes a smallscripts/pre-push.tsthat runsnpm run lintonly. Puppet smoke tests need network and tokens, so they stay out of the hook. Wechaty’s version-bump hook is not copied.cross-envis used bystart:*and is not declared. Add it as a dependency so the Windows CI scripts keep working.lintis a real recipe (npm run lint).cleangets acleanscript (shx rm -fr dist) or the target is dropped. Todaycleancalls a script that does not exist, andlintis parsed as dependencies namednpm,run, andlint.Nested
examples/professional/chatgpt-botandexamples/third-parties/codesandboxstill start viats-node. Update those start scripts tonodein the same change. Their own dependency trees stay on Wechaty 1.x.Risks
verbatimModuleSyntaxand TypeScript 7 can fail on default imports fromqrcode-terminaland puppet packages. Those are fixed in the example sources untilnpm run lint:tsis clean.Approval needed before any edit
.devcontainer, with only the Codespaces open-file added.continue-on-error, narrowed to the mock puppet if Chrome will not start.package-lock.jsonand switch CI tonpm ci.Say which of those you want changed, and I will implement on a branch and open the PR after that.
huan commentedon Nov 23, 2026
@cursor
remove the fingerpose, codesandbox, and chatgpt-bot packages in this change.
do not commit package-lock.json - make it deliberate be ignored, put it in DEVELOPMENT.md - because we want to catch errors earlier in this getting started repo if there's any version issues.
make all source code files in
.tsand writes in TypeScript - make sure Node can run ts directly.Add shebang to unit tests .ts files so that they can be run directly.
update plan for my reviewing.
cursor commentedon Nov 23, 2026
Updated plan for review. No branch, no commits, and no pull request until you approve.
Wechaty 2.0 on
wechaty/wechatymain(2.0.0-alpha.18) is still the toolchain source. The SDK dependency stays onwechaty^1.20.2. This pass changes how the repo is linted, typechecked, tested, and how examples are written. It does not move the tutorial onto the 2.0 alpha API. Coverage baselines, the npm and Docker publish workflows, and the release-branch version-bump hook stay inwechaty/wechaty. Gitpod stays as it is.What changed from the last plan
examples/tensorflow.js/fingerpose,examples/third-parties/codesandbox, andexamples/professional/chatgpt-bot.examples/tensorflow.js/goes with fingerpose, because that package is the only thing in it. Their@chatie/tsconfigfiles go with them. Thechatgpt-botdotenvfile only has empty keys.package-lock.jsonstays gitignored. It is already ignored. CI keepsnpm installandpackage-manager-cache: false. A new rootDEVELOPMENT.mdrecords why: a lockfile would hide range conflicts, and this repo should fail onnpm installwhen a range breaks, before a new user hits it. Wechaty itself still commits its lockfile. This repo does not..jssources outside those three packages are renamed to.ts, given types, and written so Node 26 runs them with built-in type stripping.ts-nodeand the--loader=ts-node/esmshebangs go away.examples/README.mddrops the “vanilla JavaScript” contribution note.tests/*.test.ts, get#!/usr/bin/env node, and the executable bit, so./tests/wechaty-puppet-mock.test.tsruns that file directly.1. Local TypeScript config
Remove
@chatie/tsconfig. Replace the roottsconfig.jsonextendswith the compiler options from Wechaty 2.0:moduleandmoduleResolution:NodeNexttarget:esnextverbatimModuleSyntax,erasableSyntaxOnly,isolatedModules,rewriteRelativeImportExtensionsstrictplusnoUncheckedIndexedAccess,noImplicitOverride,noPropertyAccessFromIndexSignaturedeclaration,declarationMap,sourceMap,skipLibCheckoutDirstaysdist.includeisexamples/**/*.tsandtests/**/*.test.ts, excludingexamples/third-parties/**.examples/third-parties/maodouandexamples/third-parties/xiaolistay in the repo and become TypeScript, but they keep their ownpackage.jsonand their own dependencies (bosonnlp,node-schedule,node-fetch, recognizers, Wechaty 0.x ranges). Those modules are not installed by the rootnpm install, so roottscdoes not include them. Each gets"type": "module"and scripts that callnodeon the.tsfile.TypeScript moves from
~5.9.3to the@typescript/nativealias Wechaty uses (typescript@^7). Theoverrides.typescriptpin goes away.npm run buildremainstsc.lint:tsistsc --isolatedModules --noEmit. Node’s type stripping does not check types.2. All sources are TypeScript, and Node runs them
Node 26 runs
.tsdirectly. Scripts and shebangs callnode, with no loader.Entry points that you run get
#!/usr/bin/env nodeand the executable bit. That set is the existing bot and CLI entry points, includingexamples/ding-dong-bot.ts,examples/cqrs/ding-dong-bot.ts,examples/advanced/dump-room-member.ts, andexamples/professional/speech-to-text-bot.ts, plus the.jsbots that already had a shebang (busy-bot,room-bot,room-say-cli, maodou, xiaoli) and the other bot entry points that are started withnode. Imported modules (listeners,config, gist-bot handlers) are TypeScript and have no shebang.Conversion rules, checked by
lint:ts:module.exportsin gist-bot handlers, hot-import listeners, and maodou helpers becomesexport..tsextension, including gist-bot’s current./on-message.jsand maodou’s./maodou-course-api.js.wechaty1.20 (Message,Contact,ScanStatus, and the rest).import typewhereverbatimModuleSyntaxrequires it.Wechaty.instance()stays where the 1.20 types still export it. A call changes only whenlint:tsrejects it, and then it becomesWechatyBuilder.build().package.jsonscripts:startandcqrsbecomenode examples/ding-dong-bot.tsandnode examples/cqrs/ding-dong-bot.ts.start:jsis removed. There is no JavaScript entry left.examples/basic/ding-dong-bot.tsstays as the short basic example. The rootexamples/ding-dong-bot.tsstays thenpm startbot.start:*keepscross-envfor the Windows CI matrix.cross-envis added as a dependency. It is used today and not declared.examples/tutorials/google-cloud-shell-tutorial.md,examples/README.md,examples/professional/blessed-twins-bot/README.md, and the monster-bot and hot-import docs and shell scripts dropnpx ts-nodeand.jspaths. The bug-report template’snode yourbot.jsbecomesnode yourbot.ts. Itsrm -rf package-lock.jsonline stays, and it matches this policy.Hot import is the one behavior risk.
hot-import-botandmonster-botpass string paths such as'./listeners/on-message'tobot.on, andhot-importloads those as JavaScript. The listeners become.ts, and the strings gain the.tssuffix. Ifhot-importcannot load a.tsfile under Node 26, those two examples switch to a normal typed import (import { onMessage } from './listeners/on-message.ts') sonodecan run them. Listener hot reload would then be gone. I will report which way it landed.3.
tstesttonode:testThe four smoke tests import
testfromtstest, and the script runs them withtap. Neithertstestnortapis a direct dependency.Rename
tests/*.spec.tstotests/*.test.ts. Each file importstestfromnode:testand assertions fromnode:assert/strict.t.passbecomesassert.ok.t.teardownbecomest.after. Theskipoption on the puppet-service test stays.Shebang on each test file:
Git mode
100755, so this works:test:smokebecomesnode --test --test-force-exit --test-timeout=180000 tests.--test-force-exitreplaces theprocess.exit(0)workaround that existed so tap would not hang on open sockets. The timeout matches Wechaty’s integration tests and covers the 100–120 second scan waits.npm testbecomesnpm run lint && npm run test:smoke.npm-run-allgoes.4. Deno test
Same experimental Deno path as Wechaty. Deno 2.9.8,
continue-on-error: true, so a Deno failure does not fail the workflow.Smoke tests need a wider permission set than Wechaty’s unit tests: network, environment, read/write, and spawning Chrome for the web puppet. The script is
test:unit:deno, withNODE_BINARYset the same way, plus--allow-netand--allow-run.lint:tsstays the typecheck. Deno runs with--no-check.If Puppeteer cannot start under Deno, the Deno script narrows to
tests/wechaty-puppet-mock.test.tsand the browser puppets stay Node-only. The CI job still exists either way.5. ESLint to Biome
Remove
@chatie/eslint-config,.eslintrc.cjs, and theeslint.validateVS Code setting.Add
@biomejs/biome^2.6.5and copybiome.json: schema 2.6.5, formatter off, assist off, linter presetnone, only thecorrectnessandsuspiciousrules Wechaty enables. That avoids a format-only diff.lint:biomeisbiome lint examples tests.lintislint:biomethenlint:ts.6. Devcontainer
Replace
.devcontainer/with the Wechaty directory:devcontainer.json— Ubuntu 24.04 base, Node 26, Deno, the feature set, Claude/Codex/Gemini/gitconfig mounts,postCreateCommand:npm installfeatures/any-packages/features/gh-auto-auth/devcontainer-lock.jsonif presentOne addition for this repo:
customizations.codespaces.openFileskeeps openingexamples/ding-dong-bot.ts. The current universal image and the globalcross-envinstall go away.7. Runner, lockfile, and
DEVELOPMENT.mdnode >= 26,npm >= 10. CI stays on macOS, Windows, and Ubuntu, with Node 26 only. The weekly cron stays. Install staysnpm install. The workflow comment points atDEVELOPMENT.mdfor the ignored lockfile. Actions stay on the current v7 checkout and setup-node..gitignorekeepspackage-lock.json. A generated lockfile is not committed.DEVELOPMENT.mdcovers three things: Node 26 runs the.tssources directly, andlint:tsis the typecheck.package-lock.jsonis ignored on purpose so a broken range fails in this repo on a freshnpm install. Tests arenode:test, with the direct shebang command, and the Deno job is experimental.ts-node,@chatie/git-scripts, andcheck-node-version.enginescovers the Node check. The pre-push hook becomes a smallscripts/pre-push.tsthat runsnpm run lintonly. Puppet smoke tests need network and tokens, so they stay out of the hook. Wechaty’s version-bump hook is not copied.lintbecomes a real recipe (npm run lint).cleangets acleanscript (shx rm -fr dist) or the target is dropped. Todaycleancalls a script that does not exist, andlintis parsed as dependencies namednpm,run, andlint.Risks
verbatimModuleSyntaxand TypeScript 7 can fail on default imports fromqrcode-terminaland puppet packages, and on the oldWechaty.instance()examples. Those are fixed in the sources untilnpm run lint:tsis clean.hot-importmay be unable to load.tslisteners. The fallback is a static import, and those two examples would no longer hot-reload.npm testdoes not install them.Still needs your approval
.devcontainer, with only the Codespaces open-file added.continue-on-error, narrowed to the mock puppet if Chrome will not start.tsc.package-lock.jsongitignored and explain that inDEVELOPMENT.md. CI stays onnpm install..jssource to TypeScript, and put#!/usr/bin/env nodeon tests and on bot entry points.Say which of those you want changed. I will implement on a branch and open the PR after that.
huan commentedon Nov 23, 2026
@cursor
approved.
Also remove hot-import-bot and monster-bot examples.
cursor commentedon Nov 23, 2026
Taking a look!
huan commentedon Nov 23, 2026
@cursor good job!
cursor commentedon Nov 23, 2026
Thanks. Glad the toolchain update landed the way you wanted.
#328 is merged into
main. It brings this repo onto the Wechaty 2 toolchain: local TypeScript config, Biome,node:test, the Deno job, the new devcontainer, and TypeScript examples that Node 26 runs directly. The fingerpose, codesandbox, chatgpt-bot, hot-import-bot, and monster-bot examples are gone, andpackage-lock.jsonstays ignored on purpose.