Repository navigation
Toolbox management: list, upload, delete, and elevated/silent runs - #37
Merged
Merged
Conversation
- Get-CWCToolbox lists the Toolbox as one object per folder and file with its path (PageService.GetToolbox); -Raw returns the server tree - Add-CWCToolboxItem uploads a file to the shared Toolbox in chunks, or creates a folder (ToolboxService.WriteToolboxFileContent); accepts files from the pipeline - Remove-CWCToolboxItem deletes a Toolbox file or folder (ToolboxService.ProcessToolboxOperation, Delete) - Send-CWCToolboxItem gains -Elevated (QueuedElevatedTool 101) and -Silent (QueuedSilentElevatedTool 117, runs as SYSTEM); credentials connections only - Toolbox paths are normalized and checked before they are sent, so a path that could name the Toolbox root, its parent or another drive is refused - A 401 "Needs permission" on a credentials connection now suggests Connect-CWC -Force: the server stops honouring an older login's management permissions while ordinary calls keep working Event and operation numbers were read from the web client of a live server; listing, upload and the silent run were exercised against it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Add-CWCToolboxItem deletes an incomplete item when a later chunk fails or the upload is stopped, says that it replaces an item, and caps -ChunkSize at 4 MB. Toolbox paths refuse device names and long parts. Send-CWCToolboxItem -Elevated and -Silent ask for confirmation. A confirmation prompt that cannot be shown now stops the command in Remove-CWCToolboxItem, Add-CWCToolboxItem, Send-CWCToolboxItem, Remove-CWCHostFromSession, Add-CWCSessionNote and Send-CWCSessionMessage; they went on and sent the request. The 401 hint on an MFA connection names Connect-CWC -Force. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Move the Toolbox notes into the 0.5.0 section (35 commands), list the commands that ask for confirmation in the README and the about topic, and regenerate the help after the rebase. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
christaylorcodes
force-pushed
the
feature/toolbox-management
branch
from
November 12, 2026 17:17
00ac838 to
4e9d942
Compare
Add-CWCToolboxItem warns when the first chunk fails with the item's state unknown, and refuses -Directory:$false instead of creating a folder. A module test rejects an early return on a negated ShouldProcess call. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Remove-CWCToolboxItem lists the Toolbox after the delete and returns CWC.ToolboxItemNotRemoved when the item is still there. Seen live: the server answers success and keeps a file it has open. Document that an -Elevated item did not start without a host connected. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.
Pull Request
Description
Adds Toolbox management to the module. Until now it could only queue an existing Toolbox item on a session; this adds listing, uploading and deleting items, and the two other run modes the server offers. Ships in 0.5.0 (35 commands).
Related Issue
None. The 401 hint relates to #31.
Type of Change
Changes Made
New functions (credentials connections only):
Get-CWCToolboxlists the Toolbox as one object per folder and file, withPath,Name,IsFolderandAttributes(PageService.GetToolbox).-Rawreturns the server's tree.Add-CWCToolboxItemuploads a file to the shared Toolbox in chunks (512 KB by default,-ChunkSizeup to 4 MB), or creates a folder with-Directory(ToolboxService.WriteToolboxFileContent). It replaces an item of the same name, and the confirmation text says so. If the upload fails or is stopped after the first chunk, the incomplete item is deleted so it cannot be run; a failure on the first chunk only warns.Remove-CWCToolboxItemdeletes a Toolbox file or folder (ToolboxService.ProcessToolboxOperation, Delete). It asks for confirmation by default. Afterwards it lists the Toolbox and returnsCWC.ToolboxItemNotRemovedwhen the item is still there, because the server answers success even when it could not delete a file it has open.Changes to existing behaviour:
Send-CWCToolboxItemgains-Elevated(QueuedElevatedTool, 101) and-Silent(QueuedSilentElevatedTool, 117). Both ask for confirmation unless-Confirm:$falseis passed, and both returnCWC.AuthModeMismatchon an API-secret connection.-NonInteractive):Remove-CWCToolboxItem,Add-CWCToolboxItem,Send-CWCToolboxItem,Remove-CWCHostFromSession,Add-CWCSessionNoteandSend-CWCSessionMessage. They now stop, and a module test rejects the pattern that caused it.Connect-CWC -Force(also for MFA connections).Connect-CWCmarks a credentials connection asLoggingInduring its validation call, so that hint is not added to a failed login.Supporting changes:
Private/Resolve-CWCToolboxPath.ps1normalises Toolbox paths and refuses, before any request, a path that could name the Toolbox root, its parent or another drive, a Windows device name (CON,NUL,COM1...) or a part longer than 255 characters.ToolboxServiceadded to the servicesInvoke-CWCServiceMethodaccepts;$script:CWCToolboxOperationand two session event numbers added tosource/prefix.ps1.[0.5.0]) and the generated help are updated.Things a reviewer should know:
.ps1opens in its default program instead of running.-Silentfor unattended runs. An-Elevateditem was queued but did not start on a machine with no host connected.CWC.ToolboxItemNotRemoved.Testing
./Tests/test-local.ps1passes (analyzer, manifest, Pester on PS 7 and 5.1, docs drift)594 Pester tests pass on PowerShell 7.6 and Windows PowerShell 5.1; PSScriptAnalyzer reports 0 errors.
Against a live on-premises server (2026-11-11 and 2026-11-12), in throwaway folders that were removed afterwards:
Get-CWCToolbox, nested folders and filesRemove-CWCToolboxItemon a file and on a folder (PS 7 and 5.1)CWC.ToolboxItemNotRemoved; a retry about two minutes later removed itSend-CWCToolboxItem, standard modeSend-CWCToolboxItem -Silent, top-level item and items in a folder (/and\)NT AUTHORITY\SYSTEMSend-CWCToolboxItem -ElevatedThe event numbers (101, 117) and the ToolboxOperation values were read from the web client's
SC.typeson that server.Checklist
source/Public/(the build exports it; no manifest edit) and has comment-based help🤖 Generated with Claude Code