uttrflow / uttrflow/uttrflow-swift
A terminal in a directory whose name has a dot is scoped to its parent, so AI suggestions resolve relative paths from the wrong place
- Dominant language
- Swift
- Stars
- 4
- Forks
- 17
- Avg merge
- 3h 32m
- Merged PRs (30d)
- 277
Description
## What happens
`FieldReading.directory(of:)` (`Sources/UttrflowPredictCapture/FieldReading.swift:114-122`) turns a document path into the directory that scopes AI suggestions. A path with an extension is taken as a file and its last component is dropped:
```swift
guard !(decoded as NSString).pathExtension.isEmpty else { return trimmed(decoded) }
return trimmed((decoded as NSString).deletingLastPathComponent)
```
A terminal whose `AXDocument` names a directory with a dot in its name, such as `~/projects/site.example.io` or `~/Library/Foo.app`, is scoped to the parent directory. Every relative path the terminal verification (#764) and the machine index resolve is then resolved from the wrong place: `cat README.md` is checked against the parent's `README.md`.
## What should happen
A document that names a directory is scoped to that directory. A trailing slash already says so (`:119`); without one, the shape of the name cannot, so the reading either asks the disk whether the path is a directory, or the terminal's document is treated as a directory because a terminal's document always is one.
## How to reproduce
`FieldReading(bundleIdentifier: "com.apple.Terminal", role: "AXTextArea", document: "file:///Users/someone/site.example.io").scope` is `/Users/someone`.
## Related
#764, #748
Contributor guide
Research direction
Start in Sources/UttrflowPredictCapture/FieldReading.swift:114-122 and reproduce the dotted-directory example from the issue. Read the related context in #764 and #748, then verify that a terminal document for a directory such as site.example.io scopes to that directory and that relative paths resolve there rather than in its parent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos, swift
- Domain
- desktop, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100