From 846086539814727b90b22d829b29fbc304e1c84c Mon Sep 17 00:00:00 2001 From: David Snelling Date: Tue, 15 Jul 2025 11:52:54 -0700 Subject: [PATCH] **refactor(cli): remove obsolete command and streamline TextEncoder/TextDecoder usage** - Removed the `test-tensorflow-textencoder` command from `cli.ts` as part of deprecating redundant tests and unused CLI functionality. - Simplified `TextEncoder` and `TextDecoder` definitions in `brainy-wrapper.js` by replacing direct constructor usage with shorthand properties within a utility object. This refactor reduces unnecessary complexity in CLI commands and improves maintainability by aligning with current project goals and streamlined test structure. --- cli-package/brainy-wrapper.js | 6 +++--- cli-package/src/cli.ts | 15 --------------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/cli-package/brainy-wrapper.js b/cli-package/brainy-wrapper.js index b9bb914a..218b6cb2 100755 --- a/cli-package/brainy-wrapper.js +++ b/cli-package/brainy-wrapper.js @@ -31,9 +31,9 @@ if ( isTypedArray: (arr) => { return !!(ArrayBuffer.isView(arr) && !(arr instanceof DataView)) }, - // Use native TextEncoder and TextDecoder - TextEncoder: TextEncoder, - TextDecoder: TextDecoder + // Instead of using constructors directly, create a utility object with constructors + TextEncoder, + TextDecoder } // Initialize TextEncoder/TextDecoder instances diff --git a/cli-package/src/cli.ts b/cli-package/src/cli.ts index e6814e11..89e4ddec 100644 --- a/cli-package/src/cli.ts +++ b/cli-package/src/cli.ts @@ -1360,21 +1360,6 @@ augmentCommand // Add the augment command to the program program.addCommand(augmentCommand) -// Add a top-level test-tensorflow-textencoder command -program - .command('test-tensorflow-textencoder') - .description('Test TensorFlow.js and TextEncoder functionality') - .action(async () => { - try { - // Import the test function from the test file - const { runTest } = await import('./test-tensorflow-textencoder.js') - await runTest() - } catch (error) { - console.error('Error:', (error as Error).message) - process.exit(1) - } - }) - // Add a top-level test-pipeline command that redirects to augment test-pipeline program .command('test-pipeline')