Skip to content

Add oi CLI wrapper and tests#3

Open
orthagonal wants to merge 2 commits into
primaryfrom
bin
Open

Add oi CLI wrapper and tests#3
orthagonal wants to merge 2 commits into
primaryfrom
bin

Conversation

@orthagonal
Copy link
Copy Markdown
Collaborator

Introduce a new oi CLI: add a shell wrapper (oi) and a Node ESM launcher (oi.mjs) that forwards args to the ai-agent-framework CLI, injects REPOSITORY_FOLDER when --data is provided, and defaults the server port to 3000 when none is supplied. Add tests (tests/oi-cli.test.mjs) for the CLI behavior and update tools/oi.mjs and package.json to expose the new binary. Update package-lock.json to reflect dependency and metadata changes. Also update AGENTS.md index stats.

Introduce a new oi CLI: add a shell wrapper (oi) and a Node ESM launcher (oi.mjs) that forwards args to the ai-agent-framework CLI, injects REPOSITORY_FOLDER when --data is provided, and defaults the server port to 3000 when none is supplied. Add tests (tests/oi-cli.test.mjs) for the CLI behavior and update tools/oi.mjs and package.json to expose the new binary. Update package-lock.json to reflect dependency and metadata changes. Also update AGENTS.md index stats.
Generate host-local stub modules for tools stored in data repositories and add a host-side node_modules resolver hook.

- New lib/oi/dataRepoToolStubs.mjs: utilities to collect tool modules, generate/delete zz-data-* stub re-exports, and prepare stubs for a data repo's tools directory.
- New lib/oi/hostNodeModulesHook.mjs and hostNodeModulesResolver.mjs: node --import hook that uses the host project's resolver (via OI_HOST_ROOT) to resolve bare specifiers from code loaded from outside the host.
- oi.mjs: integrate stub preparation and cleanup into runtime. Sets REPOSITORY_FOLDER, exports buildOiRuntimeEnv for tests, injects import hook via NODE_OPTIONS and OI_HOST_ROOT when needed, and ensures generated stubs are removed on exit.
- tests/dataRepoToolStubs.test.mjs: tests for collecting modules, writing/removing stubs, and buildOiRuntimeEnv behavior.
- package.json: include new tests in test script.
- .gitignore: ignore generated .oi/ and zz-data tool files.

This change enables using data-repo-local tools transparently from the host while preserving import.meta.url semantics and host module resolution; it also ensures generated files are cleaned up after execution.
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.

1 participant