WorktreeManager class
Manages git worktree lifecycle: creation, listing, cleanup, tmux integration.
- Inheritance
-
- Object
- Listenable
- ListNotifier
- SintController
- WorktreeManager
Constructors
Properties
-
currentSession
→ Rxn<
WorktreeSession> -
The currently active worktree session.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- initialized → bool
-
Checks whether the controller has already been initialized.
no setterinherited
- isClosed → bool
-
Checks whether the controller has already been closed.
no setterinherited
- isDisposed → bool
-
no setterinherited
- listenersLength → int
-
no setterinherited
-
onExecuteWorktreeCreateHook
↔ Future<
({String worktreePath})> Function(String slug)? -
Callback for executing worktree create hooks.
getter/setter pair
-
onExecuteWorktreeRemoveHook
↔ Future<
bool> Function(String worktreePath)? -
Callback for executing worktree remove hooks.
getter/setter pair
- onSaveProjectConfig ↔ void Function(WorktreeSession? session)?
-
Callback for saving project config.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addListener(
SintStateUpdate listener) → Disposer -
Register a closure to be called when the object notifies its listeners.
inherited
-
addListenerId(
Object? key, SintStateUpdate listener) → Disposer -
inherited
-
cleanupStaleAgentWorktrees(
DateTime cutoffDate) → Future< int> - Remove stale agent/workflow worktrees older than cutoffDate.
-
cleanupWorktree(
) → Future< void> - Cleans up the worktree, removing it and its branch.
-
configure(
{String? gitExe, String getCwd()?, String? findGitRoot(String)?, String? findCanonicalGitRoot(String)?, Future< String> getDefaultBranch()?, Future<String> getBranch()?, void saveProjectConfig(WorktreeSession?)?, Future<({String worktreePath})> executeWorktreeCreateHook(String)?, Future<bool> executeWorktreeRemoveHook(String)?, bool hasWorktreeCreateHook()?, Future<String?> readWorktreeHeadSha(String)?, void logForDebugging(String, {String? level})?}) → void -
containsListener(
SintStateUpdate listener) → bool -
inherited
-
copyWorktreeIncludeFiles(
String repoRoot, String worktreePath) → Future< List< String> > - Copy gitignored files specified in .worktreeinclude from base repo to worktree.
-
createAgentWorktree(
String slug) → Future< ({String? gitRoot, String? headCommit, bool hookBased, String? worktreeBranch, String worktreePath})> - Create a lightweight worktree for a subagent.
-
createTmuxSessionForWorktree(
String sessionName, String worktreePath) → Future< ({bool created, String? error})> - Create a tmux session for a worktree.
-
createWorktreeForSession(
String sessionId, String slug, {String? tmuxSessionName, WorktreeCreateOptions? options}) → Future< WorktreeSession> - Creates a worktree for a session. Hook-based creation takes precedence.
-
debounce<
T> (RxInterface< T> rx, void callback(T), {Duration duration = const Duration(milliseconds: 400)}) → void -
Calls
callbackafterrxstops changing forduration. Useful for search-as-you-type, form validation, etc.inherited -
dispose(
) → void -
inherited
-
ever<
T> (RxInterface< T> rx, void callback(T)) → void -
Calls
callbackevery timerxchanges. Auto-cancels on controller disposal.inherited -
execIntoTmuxWorktree(
List< String> args) → Future<({String? error, bool handled})> - Fast-path handler for --worktree --tmux. Creates the worktree and execs into tmux running Neomage inside.
-
getCurrentWorktreeSession(
) → WorktreeSession? - Gets the current worktree session.
-
getTmuxInstallInstructions(
) → String - Get tmux install instructions for the current platform.
-
hasWorktreeChanges(
String worktreePath, String headCommit) → Future< bool> - Check whether a worktree has uncommitted changes or new commits since creation.
-
interval<
T> (RxInterface< T> rx, void callback(T), {Duration duration = const Duration(seconds: 1)}) → void -
Calls
callbackat most once perduration, ignoring intermediate changes. Useful for rate-limiting UI updates.inherited -
isTmuxAvailable(
) → Future< bool> - Check if tmux is available on the system.
-
keepWorktree(
) → Future< void> - Keeps the worktree intact but clears the session.
-
killTmuxSession(
String sessionName) → Future< bool> - Kill a tmux session.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
once<
T> (RxInterface< T> rx, void callback(T)) → void -
Calls
callbackonly the first timerxchanges, then cancels.inherited -
onClose(
) → void -
Called before onDelete method. onClose might be used to
dispose resources used by the controller. Like closing events,
or streams before the controller is destroyed.
Or dispose objects that can potentially create some memory leaks,
like TextEditingControllers, AnimationControllers.
Might be useful as well to persist some data on disk.
inherited
-
onDelete(
) → void -
inherited
-
onInit(
) → void -
Called immediately after the widget is allocated in memory.
You might use this to initialize something for the controller.
override
-
onReady(
) → void -
Called 1 frame after onInit(). It is the perfect place to enter
navigation events, like snackbar, dialogs, or a new route, or
async request.
inherited
-
onStart(
) → void -
Called at the exact moment the widget is allocated in memory.
It uses an internal "callable" type, to avoid any @overrides in subclasses.
This method should be internal and is required to define the
lifetime cycle of the subclass.
inherited
-
refresh(
) → void -
inherited
-
refreshGroup(
Object id) → void -
inherited
-
removeAgentWorktree(
String worktreePath, {String? worktreeBranch, String? gitRoot, bool hookBased = false}) → Future< bool> - Remove a worktree created by createAgentWorktree.
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that the
object notifies.
inherited
-
removeListenerId(
Object id, VoidCallback listener) → void -
inherited
-
reportAdd(
VoidCallback disposer) → void -
inherited
-
reportRead(
) → void -
inherited
-
restoreWorktreeSession(
WorktreeSession? session) → void - Restore the worktree session on --resume.
-
symlinkDirectories(
String repoRootPath, String worktreePath, List< String> dirsToSymlink) → Future<void> - Symlinks directories from the main repository to avoid duplication.
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
[List< Object> ? ids, bool condition = true]) → void -
Notifies listeners to update the UI.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
generateTmuxSessionName(
String repoPath, String branch) → String - Generates a tmux session name from repo path and branch.
-
parsePRReference(
String input) → int? -
Parses a PR reference from a string.
Accepts GitHub-style PR URLs or
#Nformat. -
validateWorktreeSlug(
String slug) → void - Validates a worktree slug to prevent path traversal and directory escape.
-
worktreeBranchName(
String slug) → String - Returns the branch name for a worktree slug.