Repository navigation
Modernizing the pushapi CLI for Node 24+ - #38
Merged
Merged
Conversation
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try the Wiz Code extension for VS Code, JetBrains, or Visual Studio. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Piped configuration setup exposes the API key in captured stdout, which must be fixed before approval.
2 open issues
What changed in this PR
Modernizes the Coveo Push API CLI for Node.js 24+, replacing runtime dependencies with built-in modules and updating its programmatic API, tooling, and documentation.
Changes:
- Converts the package to ES modules and uses built-in argument parsing and HTTP requests.
- Refactors configuration, payload handling, batching, and error reporting.
- Adds automated tests, CI, modern linting, and updated usage documentation.
| File | Description |
|---|---|
| test/PushApi.test.js | Tests Push and Stream API requests and failures. |
| test/payload.test.js | Tests payload normalization and validation. |
| test/JsonBuffer.test.js | Tests batching and dry-run output. |
| test/Config.test.js | Tests configuration loading and validation. |
| test/cli.test.js | Tests CLI arguments and configuration prompts. |
| src/StreamApi.js | Converts stream operations to ES modules and shared request helpers. |
| src/PushApi.js | Simplifies Push API operations and encodes query values. |
| src/PlatformRequestsHelper.js | Replaces HTTPS callbacks with built-in fetch. |
| src/payload.js | Centralizes payload normalization and validation. |
| src/JsonBuffer.js | Refactors batching around asynchronous file operations. |
| src/errors.js | Introduces CLI and HTTP error classes. |
| src/Config.js | Adds asynchronous configuration loading and queued prompt input. |
| README.md | Updates installation, usage, configuration, and development guidance. |
| push.js | Refactors upload orchestration and exports the programmatic API. |
| package.json | Declares Node 24+, ES modules, packaging, and development scripts. |
| package-lock.json | Updates dependencies for the modernized tooling. |
| eslint.config.js | Adds flat ESLint configuration. |
| client-global.js | Replaces yargs with built-in argument parsing. |
| .nvmrc | Selects Node.js 24. |
| .npmrc | Enforces the declared Node engine requirement. |
| .jshintrc | Removes obsolete JSHint configuration. |
| .gitignore | Ignores package archives and generated buffers. |
| .github/workflows/ci.yml | Adds lint, test, and packaging checks on Node 24 and 26. |
| .eslintrc.json | Removes legacy ESLint configuration. |
| .editorconfig | Defines shared editor formatting settings. |
Review effort: Balanced
Wiz flagged one Medium IaC misconfiguration on the PR: GitHub Actions referenced by mutable tags. Pin checkout and setup-node to full commit SHAs (bumped to v7.0.1 and v7.1.0) and add step-security/harden-runner, matching the convention used across coveooss repositories. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Wiz rule "Workflow should disable lifecycle scripts during dependency installation" (Medium). Nothing in the dev dependencies needs install scripts, so npm ci runs with --ignore-scripts. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
kbeaudoin-coveo
approved these changes
Oct 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


This pull request introduces a major refactor and modernization of the project, focusing on updating the CLI, improving code quality, and enhancing documentation. The CLI is now implemented using only Node.js built-ins, removing third-party dependencies, and the package is updated to require Node.js 24 or newer. Linting and CI have been modernized, and the documentation has been rewritten for clarity. The most important changes are summarized below.
CLI and Dependency Updates:
client-global.js) is now implemented using Node.js built-in modules (parseArgs,fs, etc.), removing the dependency onyargsand making the CLI more robust and maintainable. Command-line parsing, help/version output, and error handling have been rewritten for clarity and reliability. ([client-global.jsL2-R92](https://github.com/coveooss/pushapi-nodejs/pull/38/files#diff-d1986e6eaccbcb4f79e343738aec8f7f3ddec992a8f91dfda4340129c01e625aL2-R92)).nvmrc,package.json, and.npmrc, and uses only built-in modules at runtime. ([[1]](https://github.com/coveooss/pushapi-nodejs/pull/38/files#diff-2c8effdf840690ccb88c7e21e56148978c6adb2c6926530c58ff0e47a9588b44R1),[[2]](https://github.com/coveooss/pushapi-nodejs/pull/38/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L3-L20),[[3]](https://github.com/coveooss/pushapi-nodejs/pull/38/files#diff-e813096d69c49812e40e00be9ac8fa14d77f0ec1f97ab4c45cb096b3bedd35deR1))Code Quality and Tooling:
.eslintrc.json,.jshintrc) are removed, and a neweslint.config.jsis introduced with stricter rules and support for the latest ECMAScript features. ([[1]](https://github.com/coveooss/pushapi-nodejs/pull/38/files#diff-6884918dc8291219be508e05e28965b958c734def85324f3b53858ea4702090fL1-L13),[[2]](https://github.com/coveooss/pushapi-nodejs/pull/38/files#diff-c3ca886e85c3a97b5cc4c34d04e5b9d5c78359b1e69fd09b74a842b5dea81bb0L1-L4),[[3]](https://github.com/coveooss/pushapi-nodejs/pull/38/files#diff-a32a0887ed9d1d707bbb3b845b7df7fd40e673c47e7b60a3ebd896b68d3b8839R1-R23)).editorconfigfile is added to enforce consistent editor settings across contributors. ([.editorconfigR1-R12](https://github.com/coveooss/pushapi-nodejs/pull/38/files#diff-0947e2727d6bad8cd0ac4122f5314bb5b04e337393075bc4b5ef143b17fcbd5bR1-R12)).github/workflows/ci.yml), running lint and tests on multiple Node.js versions. ([.github/workflows/ci.ymlR1-R28](https://github.com/coveooss/pushapi-nodejs/pull/38/files#diff-b803fcb7f17ed9235f1e5cb1fcd2f5d3b2838429d4368ae4c57ce4436577f03fR1-R28))Documentation Improvements:
README.mdhas been completely rewritten for clarity, including updated usage instructions, configuration details, example commands, and badges for CI and npm. ([README.mdL3-R132](https://github.com/coveooss/pushapi-nodejs/pull/38/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L3-R132))Module and Packaging Changes:
"type": "module"inpackage.json), with properexportsandbinfields for CLI usage and programmatic import. ([package.jsonL3-L20](https://github.com/coveooss/pushapi-nodejs/pull/38/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L3-L20))filesfield for correct packaging. ([package.jsonL3-L20](https://github.com/coveooss/pushapi-nodejs/pull/38/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L3-L20))Internal Refactoring:
push.jsis refactored for clarity, including improved error reporting, modular imports, and removal of legacy code. ([[1]](https://github.com/coveooss/pushapi-nodejs/pull/38/files#diff-16a2222b4430a4c0178ea7ef06d70cb5af19d293363a5d0e1b28c7f642358acbL1-L23),[[2]](https://github.com/coveooss/pushapi-nodejs/pull/38/files#diff-16a2222b4430a4c0178ea7ef06d70cb5af19d293363a5d0e1b28c7f642358acbL32-R62))These changes modernize the codebase, improve developer experience, and set a strong foundation for future enhancements.