Skip to content

Document the whole API with JSDoc - #3

Merged
kecsou merged 1 commit into
masterfrom
claude/wmctrljs-jsdoc
Oct 31, 2026
Merged

kecsou merged 1 commit into
masterfrom
claude/wmctrljs-jsdoc

Conversation

@kecsou

@kecsou kecsou commented Oct 31, 2026

Copy link
Copy Markdown
Owner

Summary

  • Every exported type, field and function in src/index.ts has JSDoc: what it does, its parameters, what it returns, and the error codes it throws (sync) or rejects with (async). The package-level comment covers what all calls share: Sync vs promise, the error message format, CAN_NOT_OPEN_DISPLAY / INTERNAL_ERROR / argument checks, and that the window manager applies actions asynchronously.
  • tsc keeps the comments in dist/index.d.ts, the file that ships, so editors show them on hover.
  • The descriptions were checked against the Rust code and the X11 tests. Examples: getWindowById on a missing window returns an empty window rather than throwing; windowMoveResize places the frame but sizes the client; -1 keeps a value.
  • scripts/build-native.js and the test helpers are documented too.
  • README fixes:
    • It said getActiveWindow could return null; it throws NO_WINDOW_ACTIVE_FOR_NOW (28).
    • It listed getWindowById without its win_id parameter.

The version stays 2.0.0, since it has not been released yet. No code changed: the diff only adds comments, plus the README.

Test plan

  • yarn build: the JSDoc is present in dist/index.d.ts
  • node --test dist/test/*.test.js against Xvfb + openbox on two screens: 156/156 pass
  • CI

🤖 Generated with Claude Code

Every exported type, field and function in src/index.ts now has JSDoc:
what it does, its parameters, what it returns and which error codes it
throws or rejects with. tsc keeps the comments in dist/index.d.ts, so
editors show them. The build script and the test helpers are documented
too.

The README said getActiveWindow could return null (it throws
NO_WINDOW_ACTIVE_FOR_NOW) and listed getWindowById without its win_id.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kecsou
kecsou merged commit 8fa21a2 into master Oct 31, 2026
17 checks passed
@kecsou
kecsou deleted the claude/wmctrljs-jsdoc branch October 31, 2026 21:08
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