uttrflow / uttrflow/uttrflow-swift
AI suggestions in a terminal read a remote ssh session's paths against this Mac's disk
- Dominant language
- Swift
- Stars
- 4
- Forks
- 17
- Avg merge
- 3h 32m
- Merged PRs (30d)
- 277
Description
## What happens
A terminal's directory for AI suggestions is `Surface.scope`, read from the field's or window's `AXDocument` (`Sources/UttrflowPredictCapture/FieldReading.swift:67-73`). The shell updates that document as it changes directory. After `ssh`, the remote shell does not, so the document keeps naming the local directory the session started in.
Everything that reads the scope then describes this Mac while the line runs on another machine:
- the whole-line path check from #764 (`TerminalLineCheck`) stats the remote command's paths on the local disk, so a local file of the same name lets a remote line through, and a remote-only path is refused;
- the machine index (`EnvironmentSource`, `Verifier.options`) offers local files, branches and programs as completions for a remote prompt;
- lines typed remotely are remembered under the local directory's surface.
## What should happen
When the terminal is running a remote session, the directory is unknown: relative paths are not suggested, and the local machine index is not offered. Possible signals, none of them checked yet: the foreground process named in the window title (Terminal.app titles carry it), a prompt of the form `user@host` that differs from this Mac's, or a document that has not changed across a `cd` the user ran.
## Related
#764
Contributor guide
Research direction
Start with the scope handling in Sources/UttrflowPredictCapture/FieldReading.swift:67-73 and trace its use through TerminalLineCheck, EnvironmentSource, and Verifier.options. Review related issue #764 and compare the possible remote-session signals described here. Done means remote sessions no longer receive relative-path suggestions or the local machine index, and their lines are not stored under the local directory.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100