Skip to content

refactor(cli): split share oclif commands - #2939

Merged
cv merged 44 commits into
mainfrom
refactor/split-share-cli-commands
May 5, 2026
Merged

refactor(cli): split share oclif commands#2939
cv merged 44 commits into
mainfrom
refactor/split-share-cli-commands

Conversation

@cv

@cv cv commented May 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Split share oclif command classes out of the SSHFS action/helper module so parser adapters and action logic are independently testable.

Stack Navigation

Changes

  • Added share-cli-commands.ts for the share parent and mount/unmount/status oclif adapters.
  • Left SSHFS action helpers in share-command.ts.
  • Updated the oclif command registry to import share command classes from the new adapter module.
  • Added direct share adapter tests with mocked share actions.

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 passes
  • npm test passes
  • Tests added or updated for new or changed behavior
  • 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

  • Tests

    • Added comprehensive unit tests for share CLI command adapters, including validation of parent usage routing and subcommand mapping to actions.
  • Refactor

    • Reorganized share CLI command structure across modules for improved code organization.

cv added 30 commits May 2, 2026 13:36
@cv cv self-assigned this May 3, 2026
@copy-pr-bot

copy-pr-bot Bot commented May 3, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented May 3, 2026

Copy link
Copy Markdown
Contributor

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: 6a90261f-d2b8-48a1-b49a-40b19baf66ca

📥 Commits

Reviewing files that changed from the base of the PR and between a3ee273 and 0e62d70.

📒 Files selected for processing (4)
  • src/lib/oclif-commands.ts
  • src/lib/share-cli-commands.test.ts
  • src/lib/share-cli-commands.ts
  • src/lib/share-command.ts

📝 Walkthrough

Walkthrough

A CLI command module reorganization moves the share command classes (ShareCommand, ShareMountCommand, ShareUnmountCommand, ShareStatusCommand) from share-command.ts to a new share-cli-commands.ts file, updates the import in oclif-commands.ts, and adds comprehensive unit tests for the moved commands.

Changes

Share Command Module Reorganization

Layer / File(s) Summary
Core Logic Extraction
src/lib/share-cli-commands.ts
New module defines ShareCommand, ShareMountCommand, ShareUnmountCommand, and ShareStatusCommand with oclif wiring. Commands delegate to existing runtime functions (runShareMount, runShareUnmount, runShareStatus, printShareUsageAndExit) imported from share-command. Includes sandboxNameArg helper and full usage/help text for each subcommand.
Legacy Module Cleanup
src/lib/share-command.ts
Removes oclif command classes and sandboxNameArg constant. Preserves internal runtime functions and usage-printing logic that are now imported by share-cli-commands.
Import Wiring
src/lib/oclif-commands.ts
Updates import source for ShareCommand and its subcommands from ./share-command to ./share-cli-commands. Public command mappings unchanged.
Tests & Verification
src/lib/share-cli-commands.test.ts
Adds unit tests for parent command usage routing and subcommand argument-to-action mapping. Mocks runtime handlers and verifies correct argument payloads passed to each command action.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A hop, a skip, a folder move—
The share commands found their groove,
From one file split to two so clean,
The finest refactor ever seen!
Tests now guard what's on the way,
Unix pipes dance another day. 🥕

✨ 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/split-share-cli-commands

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

@cjagwani cjagwani left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved as part of the oclif refactor stack — deep review confirmed the smoke flag (+1 throw) was a test mock, not production.

@cv cv added v0.0.35 and removed v0.0.34 labels May 5, 2026
@prekshivyas prekshivyas self-assigned this May 5, 2026
cv added a commit that referenced this pull request May 5, 2026
## Summary
Remove broad coverage ignores from sandbox oclif adapters whose parser
behavior can now be tested in-process.

## Stack Navigation
- Position: 40 of 60
- Previous PR: [#2937 — test(cli): cover global oclif command
adapters](#2937)
- Next PR: [#2939 — refactor(cli): split share oclif
commands](#2939)

## Changes
- Removed file-level V8 ignores from sandbox connect, lifecycle,
inspection, doctor, logs, policy/channel, snapshot, skill, and shields
adapters.
- Added direct command-adapter coverage for connect/lifecycle option
mapping, inspection actions, doctor flags, and shields flags.
- Reused existing command-family tests for logs, policy/channel
mutation, snapshot, and skill adapters.

## 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` passes
- [x] `npm test` passes
- [x] Tests added or updated for new or changed behavior
- [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](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(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

## Release Notes

* **New Features**
* Added `sandbox doctor` command for comprehensive sandbox health
diagnostics
* Extended `sandbox logs` with `--tail`/`-n` and `--since` options for
flexible log filtering
* Added short flag aliases: `-y` for `--yes`, `-q` for `--quick`, `-o`
for `--output`, `-n` for `--tail`

* **Improvements**
  * Enhanced CLI documentation with expanded flag descriptions
* Refactored `sandbox share` into discrete `mount`, `unmount`, and
`status` subcommands
  * Improved command validation and error messaging

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

---------

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv
cv marked this pull request as ready for review May 5, 2026 20:41
@cv
cv changed the base branch from refactor/coverage-sandbox-oclif-adapters to main May 5, 2026 20:41
@cv
cv enabled auto-merge (squash) May 5, 2026 20:42
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv
cv merged commit 05d6be3 into main May 5, 2026
11 checks passed

@prekshivyas prekshivyas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. Clean file split — four share oclif Command classes (ShareCommand + Mount/Unmount/Status) move verbatim from share-command.ts into a new share-cli-commands.ts. SSHFS action helpers stay in share-command.ts and are imported by the new adapter module. Zero behavior change.

+60 lines of new direct adapter tests in share-cli-commands.test.ts.

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

cv added a commit that referenced this pull request May 5, 2026
## Summary
Replace the file-level coverage ignore on sandbox log actions with
tested pure helpers and narrow ignores around subprocess-only paths.

## Stack Navigation
- Position: 42 of 60
- Previous PR: [#2939 — refactor(cli): split share oclif
commands](#2939)
- Next PR: [#2942 — test(cli): cover remaining global and credentials
adapters](#2942)

## Changes
- Removed the broad V8 ignore from `sandbox-logs-action.ts`.
- Exported and tested pure log option normalization and argv-building
helpers.
- Added narrow V8 ignores only around process-exit, OpenShell
subprocess, and follow-streaming boundaries still covered by CLI
subprocess tests.
- Added helper coverage for log probe result descriptions and probe
timeout environment handling.

## 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` passes
- [x] `npm test` passes
- [x] Tests added or updated for new or changed behavior
- [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](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)

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

---------

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Co-authored-by: Prekshi Vyas <34834085+prekshivyas@users.noreply.github.com>
@cv
cv deleted the refactor/split-share-cli-commands branch May 27, 2026 21:18
@wscurran wscurran added the refactor PR restructures code without intended behavior change label Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor PR restructures code without intended behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants