Skip to content

cli.ts file can not be executed #298

@JoInterest

Description

@JoInterest

Plugin Version

63d4750

OpenClaw Version

2026.3.13

Bug Description

Bug 回報資料(英文)

Issue: LanceDB Pro CLI (cli.ts) Cannot Run Standalone

Environment:

• OS: Linux 6.17.0 (x64)
• Node.js: v22.22.1
• Plugin version: 63d4750 (latest, 2026-03-21)
• Platform: OpenClaw plugin installed at /home/friday/.openclaw/workspace/plugins/memory-lancedb-pro/

Problem Description:

The cli.ts file cannot be executed as a standalone CLI tool. All attempts to run it directly fail with module resolution errors.

Root Causes (multiple):

  1. No entry point: cli.ts has no main() function and no if __name__ == "__main__" guard. It only exports createMemoryCLI(), a factory function that expects a pre-constructed CLIContext object.
  2. Missing bin in package.json: The package declares no CLI binary, so there's no canonical way to invoke it via npx or a global command.
  3. src/store.js does not exist at runtime: cli.ts imports ./src/store.js and ./src/retriever.js using .js extensions, but only .ts source files exist in src/. The OpenClaw plugin uses jiti for on-the-fly TypeScript compilation, which works for the plugin runtime but not for standalone CLI execution.
  4. No tsconfig.json for standalone compilation: Attempting to compile with tsc fails with strict TypeScript errors (8 errors including type mismatches and implicit any).

Attempted Fixes:

| Attempt                                   | Result                | Notes                                             |
| ----------------------------------------- | --------------------- | ------------------------------------------------- |
| node cli.ts                               | ❌ Error               | Tries to import .js files that don't exist        |
| npx tsx cli.ts                            | ❌ No output           | Silent failure, exits code 0 but produces nothing |
| npx jiti cli.ts                           | ❌ Error               | jiti loader not exported in package.json exports  |
| node --import jiti/register cli.ts        | ❌ No output           | Silent failure                                    |
| tsc compilation                           | ❌ 8 TypeScript errors | Strict mode type errors in source files           |
| Add tsx as devDependency + npx tsx cli.ts | ❌ No output           | CLI runs but produces no response                 |

Minimal Fix Required (any one of):

  1. Add a standalone entry point: Create a src/cli-main.ts that constructs the CLIContext and calls createMemoryCLI(), then export it as the bin in package.json.
  2. Or: Export main() from cli.ts: Add a function that can be called directly with the necessary context.
  3. Or: Add tsconfig.json + build step: Compile .ts.js so cli.ts can find its imports.

Error Messages:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/friday/.../memory-lancedb-pro/src/store.js'
(node:internal/modules/esm/resolve:275)
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './loader' is not defined by "exports"

Impact:
Users cannot invoke memory-lancedb-pro recall or any other CLI command directly. The recall functionality is only accessible through the OpenClaw plugin framework (via memory_recall tool registration), not as a standalone CLI.

Expected Behavior

N/A

Steps to Reproduce

N/A

Error Logs / Screenshots

Embedding Provider

None

OS / Platform

ubuntu 24.04

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions