**feat(cli): add local testing script for CLI and update versions**

- Introduced `scripts/test-cli-locally.js` to streamline local testing of the CLI package before publishing.
   - Builds main and CLI packages, creates local tarballs, and installs the CLI package globally for testing.
   - Ensures version synchronization between main and CLI packages during testing.
- Updated `cli-package/package.json` version to `0.9.23` and synchronized `@soulcraft/brainy` dependency to `0.9.22`.
- Patched `TextEncoder` fallback for Node.js v24 in `cli-wrapper.js` to ensure overall CLI compatibility.
- Added new `test-cli` npm script to `package.json`.

This update simplifies the CLI local testing process, maintains version alignment, and improves readiness for Node.js v24.
This commit is contained in:
David Snelling 2025-07-02 12:54:50 -07:00
parent 6e60b81c28
commit 72c9e371b3
6 changed files with 118 additions and 11 deletions

View file

@ -12,6 +12,21 @@ import { fileURLToPath } from 'url'
import { dirname, join } from 'path'
import fs from 'fs'
// Fix for TextEncoder in Node.js v24
// In Node.js v24, TextEncoder is a global object and not part of the util module
// This patch ensures that the util module has TextEncoder available for TensorFlow.js
if (process.versions.node.startsWith('24')) {
try {
const util = await import('util')
if (!util.TextEncoder && typeof TextEncoder !== 'undefined') {
util.TextEncoder = TextEncoder
util.TextDecoder = TextDecoder
}
} catch (error) {
console.warn('Warning: Failed to patch TextEncoder for Node.js v24:', error.message)
}
}
// Get the directory of the current module
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)

View file

@ -1,16 +1,16 @@
{
"name": "@soulcraft/brainy-cli",
"version": "0.9.21",
"version": "0.9.22",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@soulcraft/brainy-cli",
"version": "0.9.21",
"version": "0.9.22",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
"@soulcraft/brainy": "0.9.21",
"@soulcraft/brainy": "0.9.22",
"commander": "^14.0.0",
"omelette": "^0.4.17"
},
@ -2086,9 +2086,9 @@
}
},
"node_modules/@soulcraft/brainy": {
"version": "0.9.21",
"resolved": "https://registry.npmjs.org/@soulcraft/brainy/-/brainy-0.9.21.tgz",
"integrity": "sha512-UimglEpucGsiRXZlsSx4jZis0cIGKAxPU7lk/m6LvygRm01r9NPTCpsrT3mp38JMbEkzm4JpmP8vHaC5hWzXZQ==",
"version": "0.9.22",
"resolved": "https://registry.npmjs.org/@soulcraft/brainy/-/brainy-0.9.22.tgz",
"integrity": "sha512-hzEky/l4IncMIp2dMspykYD903ynft2pn6Lw9eJjZ22WhOH0pvmdX8G6sYk+7IBwY5CSSw5dm3T4EPJc53gegA==",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {

View file

@ -1,6 +1,6 @@
{
"name": "@soulcraft/brainy-cli",
"version": "0.9.21",
"version": "0.9.23",
"description": "Command-line interface for the Brainy vector graph database",
"type": "module",
"bin": {
@ -39,7 +39,7 @@
"url": "https://github.com/soulcraft-research/brainy.git"
},
"dependencies": {
"@soulcraft/brainy": "0.9.21",
"@soulcraft/brainy": "0.9.22",
"commander": "^14.0.0",
"omelette": "^0.4.17"
},
@ -57,4 +57,4 @@
"engines": {
"node": ">=24.0.0"
}
}
}