Skip to content

Modernizing the pushapi CLI for Node 24+ - #38

Merged
jdevost merged 7 commits into
masterfrom
modernize-to-node24
Oct 27, 2026
Merged

jdevost merged 7 commits into
masterfrom
modernize-to-node24

Conversation

@jdevost

@jdevost jdevost commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

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:

  • The CLI (client-global.js) is now implemented using Node.js built-in modules (parseArgs, fs, etc.), removing the dependency on yargs and 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))
  • The package now requires Node.js 24 or newer, as specified in .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:

  • ESLint configuration has been modernized: legacy config files (.eslintrc.json, .jshintrc) are removed, and a new eslint.config.js is 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))
  • A new .editorconfig file is added to enforce consistent editor settings across contributors. ([.editorconfigR1-R12](https://github.com/coveooss/pushapi-nodejs/pull/38/files#diff-0947e2727d6bad8cd0ac4122f5314bb5b04e337393075bc4b5ef143b17fcbd5bR1-R12))
  • Continuous Integration is set up via GitHub Actions (.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:

  • The README.md has 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:

  • The package is now an ES module ("type": "module" in package.json), with proper exports and bin fields for CLI usage and programmatic import. ([package.jsonL3-L20](https://github.com/coveooss/pushapi-nodejs/pull/38/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L3-L20))
  • The CLI entry point and internal modules are now listed in the files field for correct packaging. ([package.jsonL3-L20](https://github.com/coveooss/pushapi-nodejs/pull/38/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L3-L20))

Internal Refactoring:

  • The main logic in push.js is 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.

@wiz-coveo-enterprise-connector

wiz-coveo-enterprise-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities -
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations -
SAST Finding SAST Findings -
Software Management Finding Software Management Findings -
Total -

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try the Wiz Code extension for VS Code, JetBrains, or Visual Studio.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment thread src/Config.js Resolved
Comment thread README.md Resolved
jdevost and others added 5 commits October 27, 2026 14:48
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>
@jdevost
jdevost merged commit a7b6ec6 into master Oct 27, 2026
8 checks passed
@jdevost
jdevost deleted the modernize-to-node24 branch October 27, 2026 20:24
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.

3 participants