Repository navigation
[Nitro] Add nitro agent backup command - #10470
Merged
Merged
Conversation
…toring UTC entry times
…abases and case-variant archive entries
…trim restore XML docs and test the git side of a swap rollback
…orientation save racing quit
…mode label disappearing in narrow columns
Contributor
🎬 Nitro CLI E2E snapshots changedThese flow recordings differ from Run 37105049745 · full set in the nitro-e2e-snapshots artifact. |
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Archive validation permits destructive empty-root restores, and backup may follow file symlinks outside the workspace.
Review effort: Balanced
Findings: 2
Open (6)
What changed in this PR
Adds Nitro agent workspace backup/restore support and persistent TUI board orientation preferences.
Changes:
- Adds ZIP backup and validated, transactional restore commands.
- Adds activity checks, archive manifests, and JSON summaries.
- Adds selectable board layouts with persisted preferences.
| File | Description |
|---|---|
TuiShellTests.cs |
Updates footer-hint coverage. |
TuiShellTabsTests.cs |
Tests layout badges and footer rendering. |
KeyMapTests.cs |
Tests orientation shortcut. |
BoardModeTests.cs |
Tests orientation cycling and rendering. |
BoardLayoutTests.cs |
Tests forced layout decisions. |
BoardPreferencesStoreTests.cs |
Tests preference persistence. |
BoardOrientationWriterTests.cs |
Tests asynchronous preference writes. |
CommandTestBase.cs |
Supports preference-store overrides. |
RestoreAgentCommandTests.cs |
Covers restore behavior and safeguards. |
BackupAgentCommandTests.cs |
Covers archive creation and metadata. |
AgentTuiLauncherTests.cs |
Tests orientation loading and saving. |
AgentCommandTests.cs |
Tests command registration and preferences. |
TuiShell.cs |
Renders tab badges. |
ITuiMode.cs |
Adds tab-badge contract. |
TuiMessage.cs |
Adds orientation-cycle message. |
KeyMap.cs |
Binds o to layout cycling. |
BoardOrientationExtensions.cs |
Adds cycling and labels. |
BoardOrientation.cs |
Defines layout choices. |
BoardMode.cs |
Implements selectable board orientation. |
BoardLayout.cs |
Applies forced layout selection. |
AgentsMode.cs |
Suppresses irrelevant layout hint. |
ThrowHelper.cs |
Adds backup/restore errors. |
AgentWorkspaceRestoreSummary.cs |
Defines restore result. |
AgentWorkspaceArchiveSummary.cs |
Defines backup result. |
AgentWorkspaceArchiveManifest.cs |
Defines archive metadata. |
AgentWorkspaceArchive.Restore.cs |
Validates and restores archives. |
AgentWorkspaceArchive.cs |
Creates workspace archives. |
AgentWorkspaceActivity.cs |
Detects active workspace users. |
JsonSourceGenerationContext.cs |
Registers archive result types. |
IBoardPreferencesStore.cs |
Defines preference storage API. |
BoardPreferencesStore.cs |
Persists board preferences. |
BoardPreferencesJsonContext.cs |
Configures preference serialization. |
BoardPreferencesFile.cs |
Defines preference-file shape. |
BoardOrientationWriter.cs |
Coalesces background writes. |
ServiceCollectionExtensions.cs |
Registers preference storage. |
RestoreAgentCommand.cs |
Implements agent restore. |
RestoreActorOption.cs |
Adds restore actor option. |
ForceRestoreAgentOption.cs |
Adds forced restore option. |
ForceBackupAgentOption.cs |
Adds overwrite option. |
ArchiveAgentOption.cs |
Adds archive-path option. |
BackupAgentCommand.cs |
Implements agent backup. |
AgentTuiLauncher.cs |
Loads and saves board orientation. |
AgentCommand.cs |
Registers commands and preferences. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+138
to
+141
| if (manifest.Roots.Distinct().Count() != manifest.Roots.Count) | ||
| { | ||
| throw ThrowHelper.ArchiveManifestInvalid(archivePath); | ||
| } |
| var roots = string.Join(" and ", summary.Roots.Select(root => $"'{root}'")); | ||
| var files = summary.FileCount == 1 ? "file" : "files"; | ||
|
|
||
| console.OkLine($"Backed up {summary.FileCount} {files} from {roots} to '{summary.Archive}'."); |
Comment on lines
+123
to
+124
| $"Could not delete the replaced folder '{directory}'. Remove it manually." | ||
| .AsWarning()); |
Comment on lines
+317
to
+327
| await using var source = entry.Open(); | ||
| await using var file = new FileStream( | ||
| destination, | ||
| FileMode.CreateNew, | ||
| FileAccess.Write, | ||
| FileShare.None, | ||
| bufferSize: 81920, | ||
| useAsync: true); | ||
|
|
||
| await source.CopyToAsync(file, cancellationToken); | ||
| count++; |
Comment on lines
+197
to
+198
| private bool FitsOrientation(string header, int panelWidth) | ||
| => OrientationHeader(header).Length <= Math.Max(0, panelWidth - PanelChromeWidth); |
Contributor
Patch coverage94.8% of changed lines covered (871/919) +7 more changed files; see the JSON below for uncovered lines. Uncovered changed lines (JSON){
"sha": "bc79b8de97731d21b49d518ff87257a335083b91",
"files": [
{ "path": "src/Nitro/CommandLine/src/CommandLine/Tui/Input/TuiMessage.cs", "ranges": [[63, 63]] },
{ "path": "src/Nitro/CommandLine/src/CommandLine/Services/Workspace/AgentWorkspaceArchive.Restore.cs", "ranges": [[133, 134], [178, 179], [191, 192], [207, 209], [211, 213], [254, 255], [298, 299], [305, 306], [310, 312], [397, 402]] },
{ "path": "src/Nitro/CommandLine/src/CommandLine/Tui/Board/BoardMode.cs", "ranges": [[169, 170], [187, 188]] },
{ "path": "src/Nitro/CommandLine/src/CommandLine/Services/Workspace/AgentWorkspaceArchive.cs", "ranges": [[164, 165], [280, 282], [284, 286], [341, 346]] },
{ "path": "src/Nitro/CommandLine/src/CommandLine/ThrowHelper.cs", "ranges": [[60, 60], [88, 88]] }
]
}Project coverage: 57.9% (300888/519755 lines) |
… backup and escape archive paths in output
This was referenced Oct 25, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.








No description provided.