The setTimeout fallback in terminateWorker can keep the event loop open
even when the worker exits promptly, delaying shutdown paths triggered
by signals. Unref the timer so normal fast shutdown is not blocked by
this fallback.
terminateWorker is registered on SIGHUP, SIGTERM, and used in onExit.
If a signal fires and then onExit triggers (or two signals arrive),
worker.terminate() and client.call('shutdown') would fire redundantly.
Cache the pending promise so subsequent calls return the same operation.
The shutdown RPC call to the worker thread never resolved because the worker's event loop drained after cleanup, preventing the postMessage result from being delivered back to the main thread. This left process.exit() unreachable and the process hanging indefinitely.
Replace the blocking await with a fire-and-forget shutdown RPC that waits for the worker's close event (up to 5s timeout) before calling worker.terminate().
Update all github.com/Kilo-Org/kilo references to github.com/Kilo-Org/kilocode
across package.json files, documentation, scripts, and configuration files.
This reflects the repository rename from kilo to kilocode.
Replace Bun.Glob usage with a new Glob utility wrapper around the npm 'glob' package.
This moves us off Bun-specific APIs toward standard Node.js compatible solutions.
Changes:
- Add new src/util/glob.ts utility module with scan(), scanSync(), and match()
- Default include option is 'file' (only returns files, not directories)
- Add symlink option (default: false) to control symlink following
- Migrate all 12 files using Bun.Glob to use the new Glob utility
- Add comprehensive tests for the glob utility
Breaking changes:
- Removed support for include: 'dir' option (use include: 'all' and filter manually)
- symlink now defaults to false (was true in most Bun.Glob usages)
Files migrated:
- src/util/log.ts
- src/util/filesystem.ts
- src/tool/truncation.ts
- src/session/instruction.ts
- src/storage/json-migration.ts
- src/storage/storage.ts
- src/project/project.ts
- src/cli/cmd/tui/context/theme.tsx
- src/config/config.ts
- src/tool/registry.ts
- src/skill/skill.ts
- src/file/ignore.ts