SuperAPI AI Directory

xrk-botutil

Coding & development

View repository

Updated 11-05 16:20

About this skill

Authoritative documentation and entry points

  • Documentation:docs/botutil.md
  • Code:src/utils/botutil.js

Key points you need to master

  • BotUtil is an "infrastructure toolbox": logging (makeLog/makeLogID), caching (getMap/cache), files (readFile/writeFile/fileToUrl), command/async control (exec/promiseEvent/sleep), time/size formatting, etc.
  • Prefer using methods encapsulated by BotUtil rather than directly writing fs/fetch/child_process arbitrarily in business code, to ensure consistent and observable behavior.
  • Bot passes through BotUtil static methods via a proxy: e.g., Bot.makeLog、Bot.fileToUrl、Bot.exec、Bot.promiseEvent。
  • User directory (cross-platform desktop default):src/utils/user-dirs.js(getDefaultDesktopDirSync / resolveUserDesktopDirAsync), for BaseTools、tools/desktop workflow reuse; avoid hardcoding ~/Desktop。

Authoritative entry points

  • Project overview:PROJECT_OVERVIEW.md
  • Code entry:src/ and core/ corresponding subdirectories
  • Related documentation:docs/ corresponding topic documents under

Applicable scenarios

  • Need to locate the implementation path and configuration entry of this subsystem.
  • Need to quickly provide change locations and compatibility considerations.

Non-applicable scenarios

  • Not used to replace implementation descriptions of other subsystems.
  • Do not fabricate paths or fields when evidence is lacking.

Execution steps

  1. First confirm the requirement falls within the responsibility boundary of this skill.
  2. Then provide code paths, configuration paths, and key fields.
  3. Finally supplement risk points, verification steps, and regression scope.

Common pitfalls

  • Only giving concepts without specific file paths.
  • Not marking that code prevails when documentation conflicts with code.
  • Ignoring consistency among configuration, Schema, and consuming code.