Skip to content

refactor(cli): group openshell adapters#2985

Merged
cv merged 82 commits intomainfrom
refactor/layer-openshell-adapters
May 6, 2026
Merged

refactor(cli): group openshell adapters#2985
cv merged 82 commits intomainfrom
refactor/layer-openshell-adapters

Conversation

@cv
Copy link
Copy Markdown
Contributor

@cv cv commented May 4, 2026

Summary

Move OpenShell-facing adapter modules out of the flat src/lib/ directory into src/lib/adapters/openshell/** so process/runtime boundaries are visible in paths.

Stack Navigation

Changes

  • Moved OpenShell command helpers to src/lib/adapters/openshell/client.ts.
  • Moved OpenShell runtime wrapper helpers to src/lib/adapters/openshell/runtime.ts.
  • Moved OpenShell binary resolution and timeout constants to resolve.ts and timeouts.ts.
  • Moved associated tests and updated action, command, and integration-test imports.
  • Kept behavior unchanged; this PR is a structural move plus import updates.

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with doc updates
  • Doc only (prose changes, no code sample modifications)
  • Doc only (includes code sample changes)

Verification

  • npx prek run --all-files --stage pre-push passes
  • npm run build:cli
  • npm run typecheck:cli
  • OpenShell adapter targeted tests pass
  • npm run ts-migration:guard -- --base origin/refactor/layer-domain-helpers --head HEAD
  • No secrets, API keys, or credentials committed
  • Docs updated for user-facing behavior changes
  • make docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Signed-off-by: Carlos Villela cvillela@nvidia.com

Summary by CodeRabbit

Release Notes

  • Refactor
    • Reorganized OpenShell integration modules into a streamlined adapter-based structure for improved maintainability and code organization.

cv added 30 commits May 2, 2026 13:36
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 4, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 1ebe7674-9f23-4039-ba6d-86673c44e8c2

📥 Commits

Reviewing files that changed from the base of the PR and between b3c947e and 83d7c8e.

📒 Files selected for processing (46)
  • scripts/check-legacy-migrated-paths.ts
  • src/lib/adapters/openshell/client.test.ts
  • src/lib/adapters/openshell/client.ts
  • src/lib/adapters/openshell/resolve.test.ts
  • src/lib/adapters/openshell/resolve.ts
  • src/lib/adapters/openshell/runtime.ts
  • src/lib/adapters/openshell/timeouts.test.ts
  • src/lib/adapters/openshell/timeouts.ts
  • src/lib/commands/credentials/list.ts
  • src/lib/commands/credentials/reset.ts
  • src/lib/commands/debug.ts
  • src/lib/commands/simple-global-oclif-adapters.test.ts
  • src/lib/gateway-runtime-action.ts
  • src/lib/global-cli-actions.test.ts
  • src/lib/global-cli-actions.ts
  • src/lib/list-command-deps.ts
  • src/lib/maintenance-actions.ts
  • src/lib/onboard.ts
  • src/lib/policy-channel-actions.ts
  • src/lib/registry-recovery-action.test.ts
  • src/lib/registry-recovery-action.ts
  • src/lib/sandbox-config.ts
  • src/lib/sandbox-connect-action.ts
  • src/lib/sandbox-destroy-action.ts
  • src/lib/sandbox-doctor-action.ts
  • src/lib/sandbox-gateway-state-action.ts
  • src/lib/sandbox-logs-action.ts
  • src/lib/sandbox-process-recovery-action.ts
  • src/lib/sandbox-rebuild-action.ts
  • src/lib/sandbox-skill-install-action.ts
  • src/lib/sandbox-state.ts
  • src/lib/sandbox-status-action.ts
  • src/lib/sandbox-version.test.ts
  • src/lib/sandbox-version.ts
  • src/lib/services-sandbox.test.ts
  • src/lib/services.ts
  • src/lib/share-command-deps.ts
  • src/lib/snapshot-action.ts
  • src/lib/status-command-deps.ts
  • src/lib/upgrade-sandboxes-action.ts
  • src/nemoclaw.ts
  • test/config-set-nested-ssrf.test.ts
  • test/onboard-preset-diff.test.ts
  • test/policy-tiers-onboard.test.ts
  • test/resolve-openshell.test.ts
  • test/service-env.test.ts

📝 Walkthrough

Walkthrough

Move OpenShell integrations into a new adapter layout: update import paths across many modules and tests to src/lib/adapters/openshell/*, and adjust the legacy-path guard mapping for bin/lib/resolve-openshell.js to the new adapter resolve location.

Changes

OpenShell Adapter Module Restructuring

Layer / File(s) Summary
Legacy Guard
scripts/check-legacy-migrated-paths.ts
REMOVED_SHIM_MOVES mapping updated to map bin/lib/resolve-openshell.jssrc/lib/adapters/openshell/resolve.ts.
Adapter Surface & Tests
src/lib/adapters/openshell/*, src/lib/adapters/openshell/*.test.ts
Adapter module entry points and tests updated: client, runtime, resolve, timeouts now live under adapters/openshell and tests import from those adapter paths.
Core Implementation Imports
src/lib/... (commands, runtime actions, sandbox-, registry-, services*, nemoclaw.ts)
Rewired imports across the core codebase to use adapter paths (./adapters/openshell/client, ./adapters/openshell/runtime, ./adapters/openshell/resolve, ./adapters/openshell/timeouts) replacing legacy ./openshell, ./openshell-runtime, ./resolve-openshell, ./openshell-timeouts locations. No API signatures changed.
Tests & Mocks
src/lib/*/*.test.ts, test/*/*.test.ts, test/config-set-nested-ssrf.test.ts
Updated test mocks, require.resolve targets, and mock module paths to the adapter locations (e.g., dist/lib/adapters/openshell/resolve, dist/lib/adapters/openshell/client). Assertions and test logic preserved.
Wiring / Type-only Imports
src/nemoclaw.ts, assorted modules
Added/adjusted type-only imports and relocated runtime/client/timeout imports to adapter namespaces; runtime wiring unchanged aside from new module paths.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • ericksoa
  • jyaunches

Poem

🐰 I hopped through imports, neat and spry,
Moved resolves to adapters—oh my!
Tests still pass, files find their bed,
Legacy paths now gently led.
A tidy burrow, mapped and snug.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/layer-openshell-adapters

Comment @coderabbitai help to get the list of available commands and usage tips.

@wscurran wscurran added NemoClaw CLI Use this label to identify issues with the NemoClaw command-line interface (CLI). enhancement: testing Use this label to identify requests to improve NemoClaw test coverage. OpenShell Support for OpenShell, a safe, private runtime for autonomous AI agents refactor This is a refactor of the code and/or architecture. labels May 4, 2026
@cv cv requested a review from prekshivyas May 5, 2026 00:27
@cv cv added the v0.0.35 Release target label May 5, 2026
@prekshivyas prekshivyas self-assigned this May 5, 2026
@cjagwani cjagwani assigned cjagwani and unassigned cjagwani May 5, 2026
cv added a commit that referenced this pull request May 6, 2026
## Summary
Move pure CLI/domain helper modules out of the flat `src/lib/` directory
into `src/lib/domain/**` so parser, action, and domain boundaries are
visible in paths.

## Stack Navigation
- Position: 54 of 60
- Previous PR: [#2970 — refactor(cli): split oclif commands by command
tree](#2970)
- Next PR: [#2985 — refactor(cli): group openshell
adapters](#2985)

## Changes
- Moved lifecycle option normalizers to
`src/lib/domain/lifecycle/options.ts`.
- Moved duration parsing, maintenance image/upgrade helpers, sandbox
destroy/log helpers, sandbox log options, and policy/channel arg helpers
under `src/lib/domain/**`.
- Moved helper tests with their modules and updated imports from
actions, command adapters, and tests.
- Kept behavior unchanged; this PR is a structural move plus import
updates.

## Type of Change
- [x] Code change (feature, bug fix, or refactor)
- [ ] Code change with doc updates
- [ ] Doc only (prose changes, no code sample modifications)
- [ ] Doc only (includes code sample changes)

## Verification
- [x] `npx prek run --all-files --stage pre-push` passes
- [x] `npm run build:cli`
- [x] `npm run typecheck:cli`
- [x] Domain/helper targeted tests pass
- [x] No secrets, API keys, or credentials committed
- [ ] Docs updated for user-facing behavior changes
- [ ] `make docs` builds without warnings (doc changes only)
- [ ] Doc pages follow the style guide (doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)

---
Signed-off-by: Carlos Villela <cvillela@nvidia.com>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Refactor**
* Internal module structure reorganized to improve code organization and
maintainability.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Co-authored-by: Prekshi Vyas <34834085+prekshivyas@users.noreply.github.com>
@cv cv marked this pull request as ready for review May 6, 2026 02:37
@cv cv changed the base branch from refactor/layer-domain-helpers to main May 6, 2026 02:37
@cv cv enabled auto-merge (squash) May 6, 2026 02:37
cv and others added 3 commits May 5, 2026 19:38
Copy link
Copy Markdown
Contributor

@prekshivyas prekshivyas left a comment

Choose a reason for hiding this comment

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

LGTM. Same #2967/#2984-pattern PR — pure file-organization, 44 files / +86 / -83.

Four OpenShell adapter modules (client, runtime, resolve, timeouts) moved to src/lib/adapters/openshell/. 39 consumer files have one-line import-path updates. Slightly larger consumer diffs (sandbox-destroy-action.ts +6/-6, sandbox-status-action.ts +5/-2, etc.) are files that import multiple openshell adapters at once. scripts/check-legacy-migrated-paths.ts update is the migration-guard list — required for the move.

Verification checklist explicitly cites ts-migration:guard — strong signal nothing escaped the move.

CI: pr.yaml mostly green (lint/dco/check-hash/legacy-path-guard/changes PASS); macos-e2e/wsl-e2e/checks + pr-self-hosted builds still in flight at review time. No failures.

@cv cv disabled auto-merge May 6, 2026 03:05
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv cv enabled auto-merge (squash) May 6, 2026 03:07
@cv cv merged commit 2ee1264 into main May 6, 2026
12 checks passed
@ericksoa ericksoa added v0.0.36 Release target and removed v0.0.35 Release target labels May 6, 2026
cv added a commit that referenced this pull request May 6, 2026
## Summary
Add a narrow layer-boundary guard for the new CLI directory structure
before moving action/state/adapter modules further.

## Stack Navigation
- Position: 56 of 60
- Previous PR: [#2985 — refactor(cli): group openshell
adapters](#2985)
- Next PR: [#2987 — refactor(cli): group sandbox
actions](#2987)

## Changes
- Added `scripts/check-layer-import-boundaries.ts` to validate initial
import-boundary rules.
- Added a Vitest smoke test that runs the guard without source-shape
assertions.
- Enforces domain purity, no oclif imports from actions, no
command/action imports from adapters, and one registered oclif command
class per production command file.

## Type of Change
- [x] Code change (feature, bug fix, or refactor)
- [ ] Code change with doc updates
- [ ] Doc only (prose changes, no code sample modifications)
- [ ] Doc only (includes code sample changes)

## Verification
- [x] `npx prek run --all-files --stage pre-push` passes
- [x] `npx tsx scripts/check-layer-import-boundaries.ts`
- [x] `npx vitest run test/layer-import-boundaries.test.ts`
- [x] `npm run source-shape:check`
- [x] No secrets, API keys, or credentials committed
- [ ] Docs updated for user-facing behavior changes
- [ ] `make docs` builds without warnings (doc changes only)
- [ ] Doc pages follow the style guide (doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)

---
Signed-off-by: Carlos Villela <cvillela@nvidia.com>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Chores**
* Updated pre-commit hook to improve formatting behavior during commits.
* Added automated validation to enforce code architecture layer
boundaries and prevent unintended cross-layer imports.
* **Tests**
* Added an automated test to verify the new layer-boundary validation
runs successfully and reports passing status.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement: testing Use this label to identify requests to improve NemoClaw test coverage. NemoClaw CLI Use this label to identify issues with the NemoClaw command-line interface (CLI). OpenShell Support for OpenShell, a safe, private runtime for autonomous AI agents refactor This is a refactor of the code and/or architecture. v0.0.36 Release target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants