Skip to content

Upgrade getting-started to Wechaty 2 & WinterTC best practices - #330

Merged
huan merged 1 commit into
mainfrom
upgrade-wintertc-329
Nov 27, 2026
Merged

huan merged 1 commit into
mainfrom
upgrade-wintertc-329

Conversation

@huan

@huan huan commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Closes #329

Summary

  • Toolchain & Config: Removed legacy experimentalDecorators / emitDecoratorMetadata from tsconfig.json, removed check-node-version / postinstall (relying on engines), added cross-platform clean script, aligned biome.json schema to 2.6.9, and added markdownlint-cli + .markdownlint.json.
  • Smoke Tests & Deno: Refactored tests/wechaty-puppet-mock.test.ts and tests/wechaty-puppet-neo.test.ts to use t.after() cleanup and node:test timeouts, removed --test-force-exit, and scoped Deno permissions in test:unit:deno.
  • Examples: Pruned legacy v1 examples (examples/advanced/, examples/professional/, examples/basic/contact-bot.ts, examples/ambient-modules.d.ts) while keeping examples/cqrs/ for future upgrade; updated examples/ding-dong-bot.ts and examples/basic/ding-dong-bot.ts to use helpers.typeName(ScanStatus, status) and Wechaty 2 types.
  • CI & Docs: Added permissions: contents: read to the build job in .github/workflows/node.js.yml, added AGENTS.md, and updated DEVELOPMENT.md, README.md, and examples/README.md.

Verification

  • npm test (lint:biome, lint:ts, lint:md, test:smoke): 2 passed, 0 failed
  • npm run test:unit:deno: 2 passed, 0 failed
  • npm run build && npm run clean: passed

Note

Medium Risk
Large removal of public example code and a Wechaty 2 dependency shift can break users on old tutorials; runtime/test changes are lower risk for the core starter bot.

Overview
This PR realigns the repo as a Wechaty 2 / Node 26 / TypeScript 7 starter: docs now target wechaty >=2.0.0-0 <3, drops decorator-related tsconfig options for erasable-only TS, and adds AGENTS.md, markdownlint (lint:md), a clean script, and replaces check-node-version/postinstall with engines only.

Examples are heavily trimmed: legacy v1 samples under examples/advanced/, examples/professional/, and most of basic/ are removed, along with ambient-modules.d.ts; examples/cqrs/ stays but stays excluded from root tsconfig. The remaining ding-dong bots use helpers.typeName(ScanStatus, status) and type casts where puppet packages still ship v1 puppet types.

Tests and CI: smoke tests use t.after() cleanup, drop --test-force-exit, and tighten Deno sandbox flags; CI adds permissions: contents: read on the build job.

Reviewed by Cursor Bugbot for commit 94e9830. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor

cursor Bot commented Nov 27, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 05f2f040-c36f-4290-9c04-abf9162a6d4b)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 94e98303ba

ℹ️ 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".

Comment on lines +33 to +34
process.off('unhandledRejection', onUnhandledRejection)
await bot.stop().catch(() => undefined)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Handle Neo's background login rejection before stopping

When this smoke test runs without anyone scanning the QR code, Neo rejects its background login promise during shutdown, as documented by the existing workaround. Removing the rejection listener before bot.stop() leaves that rejection unhandled; catching the promise returned by bot.stop() does not catch a separate background promise. Even retaining a logging-only listener would not prevent node:test from reporting the unhandled rejection as a failure. Consequently, the unattended Neo smoke test can emit its scan event and pass its assertion yet still fail npm test and the Node.js CI matrix. Handle the background login rejection itself, or isolate the expected cancellation from the test runner, before removing the previous workaround.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-27T19:54:53.001715Z 94e9830 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@huan
huan merged commit dd8c657 into main Nov 27, 2026
6 checks passed
@huan
huan deleted the upgrade-wintertc-329 branch November 27, 2026 19:58
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.

Upgrade getting-started to Wechaty 2 & WinterTC best practices

2 participants