Skip to content

fix: v3.6.2 bug fixes, shell completions, and test coverage backfill#49

Merged
chenliuyun merged 44 commits into
mainfrom
fix/v3.6.2-bugs
May 17, 2026
Merged

fix: v3.6.2 bug fixes, shell completions, and test coverage backfill#49
chenliuyun merged 44 commits into
mainfrom
fix/v3.6.2-bugs

Conversation

@chenliuyun
Copy link
Copy Markdown
Collaborator

Summary

  • Fix device-meta JSON export, --strict exit-code, doctor message, and webhook port race condition
  • Fix PowerShell value completions, plan device ordering, and device-meta hidden hint
  • Fix plan --device= ordering and device-meta --all --json warning
  • Fix webhook socket close after 413; add shell completions for auth, policy, rules, status-sync, daemon command groups
  • Fix auth keychain leaf-verb completions in zsh (rest state) and PowerShell (trailing-space $prev guard)
  • Bundle @modelcontextprotocol/sdk and move non-external deps to devDependencies
  • Backfill test coverage across auth, config, plan, rules, doctor, quota, completion, status-sync, daemon, and webhook-listener
  • Add layered coverage thresholds (global and src/commands) enforced in CI

Test plan

  • npm test — all 2574+ tests pass
  • switchbot completion zshswitchbot auth keychain <Tab> offers describe get set delete migrate
  • switchbot completion powershellswitchbot auth keychain <Tab> (trailing space) offers leaf verbs, not keychain again
  • switchbot completion bash / fish — unaffected, existing behaviour preserved

chenliuyun added 30 commits May 16, 2026 23:22
- plan suggest: exit(2) on missing --device (was exit(1) — usage error, not runtime)
- plan suggest: accept --devices as alias for --device (agent-friendly plural form)
- doctor: clarify MCP tool count as default profile (13/24) to explain discrepancy with mcp tools
- quota: show reset cadence ("resets daily at midnight local time") in plain text output
- bash completion: add --format value completion (table/json/jsonl/tsv/yaml/id/markdown) and --table-style values; fix zsh to include missing markdown format
- meta list: default now hides 'hidden' devices; --all shows everything, --hidden-only shows only hidden
- devices status: add --strict flag to exit 1 when any batch device fetch fails
- quota: show computed next-midnight reset time in plain text output
- bash completion: add --backoff (linear/exponential) and --cache (off/auto/5m/1h) value completions
chenliuyun added 14 commits May 17, 2026 11:22
…devDependencies

Move all bundled runtime deps (ajv, ajv-formats, chalk, cli-table3, commander,
croner, js-yaml, uuid, yaml, zod) and @modelcontextprotocol/sdk from dependencies
to devDependencies. Remove @modelcontextprotocol/sdk from esbuild external list so
it is inlined at build time. Fix ajv-formats import from require() to static import
so esbuild can inline it instead of leaving a runtime require() call.

Result: user-side node_modules shrinks from ~43 MB / 160 packages to ~23 MB / 84
packages (-47%). dist/index.js grows by ~300 KB (2.3 → 2.6 MB).

Add tests/bundle-self-contained.test.ts to guard against future regressions.
…hook port race

- device-meta: include hidden devices in JSON mode by default (only filter in
  human table mode); human mode behavior unchanged
- devices: replace process.exit(1) with process.exitCode in --strict batch path
  to allow cleanup to complete; warn when --strict is passed outside batch mode
- doctor: clarify mcp check message to say 'mcp serve --tools all' instead of
  generic '--tools all'
- webhook-listener: read server.address() inside the 'listening' callback to
  avoid an async-gap race on Windows IOCP; drain oversized request body with
  req.resume() instead of req.destroy() so 413 response can flush before teardown
…den hint, sinks coverage

- completion: move --format/--table-style/--backoff/--cache $prev checks before
  the $count-le-2 guard; trailing-space leaves $count=2 so the guard fired first,
  swallowing enum completions entirely
- plan: scan process.argv in order to collect --device/--devices values instead of
  [...opts.device, ...opts.devices], which reorders mixed flags (A C B instead of A B C)
- device-meta list: before printing "No local metadata entries", check whether the
  file contains hidden records and suggest --all/--hidden-only if so
- vitest.config: replace src/sinks/** glob with individual live-adapter paths so
  unit-testable dispatcher.ts and format.ts are no longer excluded from coverage
- plan suggest: extend process.argv scan to handle --device=VALUE and
  --devices=VALUE (equals-sign syntax) so mixed input preserves order
- devices meta list: warn to stderr when --all is combined with --json
  since JSON mode always exports all records regardless of the flag
…mmand groups

- webhook-listener: destroy socket on res finish after sending 413 so
  a client streaming indefinitely cannot hold the connection open
- completion: add policy/rules/auth/status-sync/daemon subcommand
  completions across bash, zsh, fish, and PowerShell; also add nested
  auth keychain subcommand completions (describe/get/set/delete/migrate)
…-space

- zsh: add auth/keychain branch in the rest state so _describe fires
  auth_keychain_sub instead of falling back to file completion
- PowerShell: add $prev -eq 'keychain' early-return before the $count
  guard, matching the --format pattern, so Tab after a trailing space
  emits authKeychainSub instead of authSub
- zsh completion: add policy_sub/rules_sub/auth_sub/auth_keychain_sub/status_sync_sub/daemon_sub to local -a
- devices: document --strict single-device asymmetry (no exitCode semantics in batch-less path)
- plan suggest: extend argv-scan comment to explain why command.parseOptions() is not sufficient
- device-meta: clarify --all is human-mode only (JSON always exports all records)
- bundle-self-contained test: skip dist import check gracefully when dist/index.js is absent
- PowerShell completion: comment explaining mutual exclusivity of the two auth keychain paths
- README: replace hardcoded test count with approximate value
@chenliuyun chenliuyun merged commit cc3b11c into main May 17, 2026
14 checks passed
@chenliuyun chenliuyun deleted the fix/v3.6.2-bugs branch May 18, 2026 01:43
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