Align tests with runtime sandbox and polish terminal help

- Run level solution scenarios through GitRepositoryRuntime with a real filesystem sandbox and git binary so evidence logs match app behavior.
- Materialize synthetic remotes as local bare repositories and configure upstream tracking for pull/push levels.
- Route mobile-hostile Git interactions through shared sandbox semantics for clone, patch add, interactive rebase, squash merge, submodule, stash, revert, and related flows.
- Relax affected level validators to inspect observable runtime state instead of fallback-only staged/index details.
- Show .git in ls output for native and fallback helper commands.
- Make tab completion resolve filenames and directories relative to the current working directory.
- Integrate help controls into the callout overlay and reposition the prompt callout above the terminal prompt.
- Add regression coverage for .git listing and subfolder completion.
This commit is contained in:
Joe Tretter
2026-05-06 22:12:25 -05:00
parent e1b2d7f7a1
commit 7bb14216ef
14 changed files with 241 additions and 69 deletions

View File

@@ -166,7 +166,9 @@ object GitSandboxEngine {
}) to emptyList()
}
parts[0] == "echo" -> writeEcho(repo, shellParts)
parts[0] == "ls" || parts[0] == "dir" -> repo to repo.files.filterNot { it.deleted }.map { it.name }.ifEmpty { listOf() }
parts[0] == "ls" || parts[0] == "dir" -> repo to (
if (repo.initialized) listOf(".git") else emptyList()
) + repo.files.filterNot { it.deleted }.map { it.name }
parts[0] == "cd.." -> repo.copy(currentDir = parentDirectory(repo.currentDir)) to emptyList()
parts[0] != "git" -> repo to listOf("Command not supported in sandbox. Try a git command or 'touch'.")
parts.size >= 2 && parts[1] == "init" -> repo.copy(initialized = true, branches = mapOf("master" to repo.commits.size)) to listOf("Initialized empty Git repository")
@@ -553,7 +555,12 @@ object GitSandboxEngine {
arguments.isNotEmpty() -> repo.branches + (repo.headBranch to maxOf(repo.branches[repo.headBranch] ?: 0, repo.branches[arguments.last()] ?: 0))
else -> repo.branches
}
return repo.copy(commits = commits, branches = updatedBranches) to emptyList()
val maintenanceActions = if ("--onto" in arguments) {
repo.maintenanceActions + "rebase-onto"
} else {
repo.maintenanceActions
}
return repo.copy(commits = commits, branches = updatedBranches, maintenanceActions = maintenanceActions) to emptyList()
}
private fun commit(repo: RepoState, arguments: List<String>): Pair<RepoState, List<String>> {