Skip to content

Conversation

@ChrisPenner
Copy link
Member

@ChrisPenner ChrisPenner commented Aug 1, 2025

Overview

A feature requested by Paul and Cody, also see here: https://discord.com/channels/862108724948500490/1200119435931942994/1400567949357617302

This allows you to simply specify ucm transcript.in-place -c foo and it will run the transcript on foo in-place.

This uses the default codebase if unspecified, and will create a new codebase, then modify it if passed with -C to a codebase which doesn't already exist.

If the old workaround of transcript.fork -S codebase -C codebase is provided, this will now issue a warning suggesting to use transcript.in-place explicitly instead.

Implementation notes

  • Adds a new subcommand
  • Adds a new InPlace configuration for the transcript runner
  • Refactors the transcript pre-post commands into a bracketed style to ensure resource cleanup
  • Detects and warns if using fork with save-to on the same codebase.
  • Did a small tweak to normalize output paths, so instead of:
💾  Wrote /Users/cpenner/dev/unison/./gi/basic-transcript.output.md

We now get:

💾  Wrote ./gi/basic-transcript.output.md

If the path is outside of the current dir It will remain an absolute path as you'd expect.

Test coverage

I tested manually:

  • Creating a new codebase using transcript.in-place
  • Modifying an existing codebase using transcript.in-place
  • Modifying my default codebase with transcript.in-place
  • Saving a codebase in-place with transcript.fork, and getting a warning. (Also tried with mismatched but canonically equal paths, like relative vs absolute, etc.)
  • Tested transcript.fork to ensure it still works
  • Tested transcript to ensure it still works

pure tmp
-- | Prep the codebase for transcripts, then pass the directory to the action.
-- After the action the codebase will be deleted/copied/saved as indicated.
withTranscriptDir :: Verbosity.Verbosity -> String -> TranscriptCodebaseSetup -> Maybe CodebasePathOption -> (FilePath -> IO r) -> IO (Maybe r)
Copy link
Member Author

Choose a reason for hiding this comment

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

Apologies for the noisy refactor here, I switched it to use bracket to ensure proper cleanup.

Copy link
Member

@pchiusano pchiusano left a comment

Choose a reason for hiding this comment

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

Nice!!

@aryairani
Copy link
Contributor

Oh lovely

@aryairani aryairani merged commit 5168837 into trunk Aug 2, 2025
31 checks passed
@aryairani aryairani deleted the cp/transcripts-in-place branch August 2, 2025 04:04
sellout added a commit to sellout/unison that referenced this pull request Aug 28, 2025
The interpreter tests are broken by unisonweb#5819 which (wisely) fails
`transcript.fork` when it’s run with the same source and target
codebase. This updates the interpreter tests to use
`transcript.in-place` instead.
sellout added a commit to sellout/unison that referenced this pull request Aug 28, 2025
The interpreter tests are broken by unisonweb#5819 which (wisely) fails
`transcript.fork` when it’s run with the same source and target
codebase. This updates the interpreter tests to use
`transcript.in-place` instead.

(cherry picked from commit dc61f22)
@sellout sellout mentioned this pull request Aug 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants