calls each with autocontinue

This commit is contained in:
Nathan
2025-08-26 15:56:42 -06:00
parent 7d86cae5b1
commit f412610a76
2 changed files with 100 additions and 1 deletions

View File

@@ -587,3 +587,102 @@ The rename operation ran before any copying to `_CURRENT`, so all sequences now
---
_**User**_
2 edits:
1. @UpdateSequences.bat let's have it so that when it finds a sequence to replace, it wipes the entire sequence from _CURRENT.
2. @UpdateAllSequences.bat let's have this batch hit enter every time the batches `echo Done.` so that the updateseq batch can still have a pause in it without having to do so manually.
---
_**Assistant**_
<think><details><summary>Thought Process</summary>**Updating sequence edits**
The user wants an update where the script wipes the entire sequence from _CURRENT before making a copy. To do that, we can modify the batch file to output the plan first. Then, before copying any files, the existing sequences should be deleted. Currently, the PowerShell script doesnt support this as it prints the plan and then executes the copy. We might also consider modifying the PowerShell script to delete the destination directory before proceeding with robocopy to meet the users request more simply.
**Editing UpdateSequences.bat**
The user requested edits to UpdateSequences.bat, but the detection for replacing sequences seems tied to the PowerShell script (PS). I recognize that while the request focuses on the batch file, we can mirror that functionality in PowerShell to manage deletions better. Our instructions tell us not to output code, so I need to create a TODO list with two items.
First, Ill modify UpdateSequences.ps1 to delete destination folder contents before copying, ensuring it wipes out previous data as per the user's requirements. I'll log these deletions.
**Clarifying user requests**
The user specifically wanted changes to UpdateSequences.bat, but I see that modifying the PowerShell script can ensure the wiping functionality. However, let's focus on the user's second request regarding UpdateAllSequences.bat. They want this script to automatically hit enter every time it shows "Done," allowing it to pause without needing manual input.
Currently, UpdateSequences.bat ends with "exit /b %rc%", which doesn't incorporate a pause. Ill explore using echo to send a newline, but I need to clarify if it will work properly with the pause command in the inner script.
**Exploring methods for batch processes**
Im considering several ways to handle input for UpdateSequences.bat. One approach is using `echo.|call "UpdateSequences.bat"` to send a newline, or I could try `cmd /c ""UpdateSequences.bat" < NUL"` for an EOF, but that doesn't trigger the pause effectively. The pause command reads from STDIN, so it seems like providing a newline via an echo pipe should work.
While using `call` within a loop, I also need to be mindful of the errorlevel, as it can be tricky. I think using `echo. | call "UpdateSequences.bat"` might be the safest bet, and then I can check the errorlevel after execution.
**Implementing required changes**
Im set to replace `call "UpdateSequences.bat"` in UpdateAllSequences.bat with `echo.| call "UpdateSequences.bat"`. For the wiping of the current sequence, I realize I need to modify the PowerShell script because the user specified changes to the batch file, but they also likely want to ensure the deletion of sequences happens first before copying.
To address this, I plan to edit the PowerShell script to include a step that checks for the existence of a sequence directory before copying. I need to be careful not to delete the `_archive` folder since the user may not want that removed.
Next, Ill use the edit_file function to apply these changes, ensuring I include the necessary context when proposing the edits.</details></think>
---
Let me make the two requested edits:
1) Ensure the destination sequence folder in `_CURRENT` is wiped before copying a sequence.
2) Modify the aggregator batch to automatically send an Enter to any paused child batch.
Now I'll implement the changes.
---
Read file: undefined
---
<think><details><summary>Thought Process</summary>**Implementing sequence edits**
I need to implement two edits regarding the script. The user's request about UpdateSequences.bat indicates that when it finds a sequence to replace, it should wipe the entire sequence from _CURRENT. However, the real action happens in UpdateSequences.ps1, since the batch file just calls the PS1.
I'll modify the PowerShell script to ensure it deletes the destination sequence folder under _CURRENT before executing robocopy. It might be best to confirm what they mean by "wipe entire sequence" for each [COPY] entry before mirroring.
**Wiping and mirroring sequences**
I'm thinking about using Robocopy with the /MIR option to effectively mirror changes and remove any extras from the destination that arent in the source. But sometimes, we might want to wipe the destination completely to avoid mismatched names lingering around. The command removes extras, but since /XD '_archive' skips that directory, leftovers could still exist.
To address this, I need to add code before the robocopy command that checks if the destination path exists; if it does, I should remove it entirely and then recreate it. Ill handle errors by using Remove-Item with the right parameters. Also, I must maintain a consistent four-space indentation style throughout the script.
**Updating batch sequences**
For UpdateAllSequences.bat, I need it to automatically hit enter every time batches echo "Done," allowing the update sequence batch to pause without manual intervention. Im considering using piping to send an Enter press to the child consoles when they pause. However, the "pause" command reads from console input, not from STDIN, so simply piping won't work as expected.
Since piping a newline usually works with the pause command, I need to ensure that when "UpdateSequences.bat" is called, it receives the enter signal correctly during its pause.
**Finding input methods for batches**
Im exploring ways to ensure that Enter is sent automatically in batch scripts, especially after "Done." Using (echo()|call script) is a trick, but pause doesnt read from STDIN. I could try echo(| call script, but I'm not entirely sure if that works.
There's also 'echo.| call script' to simulate Enter, as it sends a newline to the console input. The pause command reads from the key input buffer, not from STDIN, so I need to find a way to handle this without skipping pause entirely. The 'choice' command might be another option to consider.
**Implementing small changes**
Im looking at a small change that spans two files. Even though the todo_spec suggests creating a todo list for multi-step tasks, it's a minor update, so I think I can skip that for now.
However, the flow requires that I provide status updates around tool calls. Ill add a quick note saying, "I'll implement edits now" before calling for patches, and another update after the edits and linting. Finally, Ill wrap up with a summary bullet points to clarify what has been done. Let's move forward with the patches!</details></think>
---
I'll implement the two edits now: add a pre-copy wipe in the PowerShell script, and make the aggregator auto-continue paused child batches by redirecting input from NUL.
---
---
---
---
- UpdateSequences.ps1: Before copying a sequence to `_CURRENT`, it now wipes the entire destination sequence folder if it exists, then recreates it, and mirrors. This guarantees a clean replacement. Logged as “WIPE” in `_UpdateSequences.log`.
- UpdateAllSequences.bat: Calls each `UpdateSequences.bat` with input redirected from NUL, so any `pause` in child batches auto-continues without manual input.
---

View File

@@ -39,7 +39,7 @@ for /d %%S in (*) do (
set /a count+=1
echo [!count!/!found!] Running UpdateSequences.bat in %%S...
pushd "%%S"
call "UpdateSequences.bat"
call "UpdateSequences.bat" < NUL
set "rc=!errorlevel!"
popd
if !rc!==0 (