Skip to content

refactor(cli): group global actions#2988

Merged
cv merged 87 commits intomainfrom
refactor/layer-global-actions
May 6, 2026
Merged

refactor(cli): group global actions#2988
cv merged 87 commits intomainfrom
refactor/layer-global-actions

Conversation

@cv
Copy link
Copy Markdown
Contributor

@cv cv commented May 4, 2026

Summary

Move top-level/global workflow action modules into src/lib/actions/** so command adapters call a visible action layer instead of flat src/lib modules.

Stack Navigation

Changes

  • Moved deploy, maintenance, onboarding facade, root help, upgrade-sandboxes, and global action facade modules under src/lib/actions/.
  • Moved the global action facade test with the module.
  • Updated command adapters, root bootstrap, integration tests, and callers to the new paths.
  • 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
  • npx tsx scripts/check-layer-import-boundaries.ts
  • Global command/action targeted tests pass
  • 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 [email protected]

Summary by CodeRabbit

  • Refactor
    • Internal reorganization of CLI action module structure for improved code organization and maintainability.

cv added 30 commits May 2, 2026 13:36
@cv cv self-assigned this May 4, 2026
@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented May 4, 2026

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
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 83b78248-ea34-410b-9463-4e55e05daa12

📥 Commits

Reviewing files that changed from the base of the PR and between 301b0a7 and 4e599ed.

📒 Files selected for processing (4)
  • src/lib/actions/maintenance.ts
  • src/lib/actions/root-help.ts
  • src/lib/commands/onboard.test.ts
  • src/nemoclaw.ts

📝 Walkthrough

Walkthrough

This pull request reorganizes module structure by consolidating CLI action exports into a single public API surface at src/lib/actions/global.ts, replacing the separate global-cli-actions module. Internal action modules adjust import paths to use parent-directory references, and all consuming code updates its import sources accordingly. New wrapper functions showRootHelp, showVersion, and runOpenshellProviderCommand are added to the global module. Tests and entry points are updated to reference the new module paths.

Changes

Module Import Path Consolidation

Layer / File(s) Summary
Internal Module Structure
src/lib/actions/deploy.ts, src/lib/actions/maintenance.ts, src/lib/actions/onboard.ts, src/lib/actions/root-help.ts, src/lib/actions/upgrade-sandboxes.ts
Action module imports are refactored from current-directory (./) to parent-directory (../) paths, aligning internal module dependencies with the new directory structure. Module names are also standardized (e.g., maintenance-actionsmaintenance).
Global Public API Consolidation
src/lib/actions/global.ts
Imports are restructured to reference renamed action modules; new public wrapper functions showRootHelp(), showVersion(), and runOpenshellProviderCommand() are introduced to serve as the unified public facade for all CLI actions previously split across separate exports.
Global Module Test Updates
src/lib/actions/global.test.ts
Test mocks are reorganized to target new internal module paths and consolidate testing of all public CLI action exports under the single ./global module surface.
Consumer Import Updates
src/lib/commands/*.ts, src/lib/commands/*/*.ts, src/nemoclaw.ts
All command and entry-point files update their imports from ../global-cli-actions to ../actions/global, establishing a single import source for CLI actions.
Test Suite Updates
src/lib/commands/*.test.ts, test/credentials-cli-command.test.ts, test/image-cleanup.test.ts, src/lib/commands/onboard.test.ts
Test mock paths and module imports are updated to reference the new ../actions/global module and adjusted action module paths.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 A path once tangled, now made clear,
All actions gathered, drawing near,
From scattered imports to one shared door,
The global module exports more,
With every import aligned just right,
The codebase dances in the light!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main structural change: moving global workflow actions into src/lib/actions/ to improve organization.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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-global-actions

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). 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
@ericksoa ericksoa added v0.0.36 Release target and removed v0.0.35 Release target labels May 6, 2026
@cv
Copy link
Copy Markdown
Contributor Author

cv commented May 6, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

cv added a commit that referenced this pull request May 6, 2026
## Summary
Move sandbox-scoped workflow action modules into
`src/lib/actions/sandbox/**` so command adapters and sandbox workflow
orchestration have separate, visible layers.

## Stack Navigation
- Position: 57 of 60
- Previous PR: [#2986 — test(cli): enforce initial layer import
boundaries](#2986)
- Next PR: [#2988 — refactor(cli): group global
actions](#2988)

## Changes
- Moved sandbox
connect/destroy/rebuild/status/logs/doctor/gateway-state/process-recovery/skill/snapshot
actions under `src/lib/actions/sandbox/`.
- Moved sandbox policy/channel action helpers under
`src/lib/actions/sandbox/policy-channel.ts`.
- Updated command adapters, runtime dispatch facade, tests, and
remaining callers to the new paths.
- 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] `npx tsx scripts/check-layer-import-boundaries.ts`
- [x] Sandbox command adapter 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 <[email protected]>


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

* **Bug Fixes**
* Enhanced sandbox cleanup during destruction to properly unload Ollama
models, terminate proxy processes, and stop host services for complete
resource cleanup.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Carlos Villela <[email protected]>
@cv cv marked this pull request as ready for review May 6, 2026 16:26
@cv cv changed the base branch from refactor/layer-sandbox-actions to main May 6, 2026 16:26
@cv cv enabled auto-merge (squash) May 6, 2026 16:26
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 #2984/#2985-pattern PR — pure file-organization, 26 files / +64 / -64.

Six action modules (deploy, global + test, maintenance, onboard, root-help, upgrade-sandboxes) moved under src/lib/actions/. The +N/-N on moved files reflects their internal imports shifting. 19 consumer files (commands, nemoclaw.ts, tests) have one-line import-path updates.

Verification checklist explicitly cites running check-layer-import-boundaries.ts from #2986 — strong signal nothing escapes the new layer rules.

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

@cv cv merged commit aaf1f1a into main May 6, 2026
13 checks passed
cv added a commit that referenced this pull request May 6, 2026
## Summary
Move registry, config, path, gateway, session, and sandbox persistence
modules into `src/lib/state/**` so persistence boundaries are visible in
paths.

## Stack Navigation
- Position: 59 of 60
- Previous PR: [#2988 — refactor(cli): group global
actions](#2988)
- Next PR: [#2991 — refactor(cli): group docker
adapters](#2991)

## Changes
- Moved registry/config/path/gateway/session/sandbox state modules under
`src/lib/state/`.
- Moved co-located state tests and updated dist/source paths in
integration tests.
- Updated action, command, onboarding, policy, service, and test imports
to the new state paths.
- Updated CodeRabbit path instructions and migrated-path guard canonical
paths for moved state modules.
- 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] `npx tsx scripts/check-layer-import-boundaries.ts`
- [x] State and registry 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 <[email protected]>


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

* **Refactor**
* Reorganized internal state management modules into a dedicated
directory structure to improve code organization and maintainability.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Carlos Villela <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NemoClaw CLI Use this label to identify issues with the NemoClaw command-line interface (CLI). 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