Skip to content

Commit 984e8f0

Browse files
committed
checkpoint: work on a fix for agent — AutoPilot.swift
Auto-checkpoint after successful build (1 file). Task: work on a fix for agent Changed: M Agent/AgentViewModel/Features/AutoPilot.swift
1 parent b0e63fa commit 984e8f0

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

‎Agent/AgentViewModel/Features/AutoPilot.swift‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,15 @@ extension AgentViewModel {
225225
}
226226
return true
227227
}
228-
if lower.hasPrefix("add ") || lower.hasPrefix("remove ") {
229-
let isAdd = lower.hasPrefix("add ")
230-
let raw = arg.dropFirst(isAdd ? 4 : 7).trimmingCharacters(in: .whitespaces)
231-
let folder = (raw as NSString).expandingTildeInPath
228+
let isAddCmd = lower.hasPrefix("add ")
229+
let pathArg = arg.dropFirst(isAddCmd ? 4 : 7).trimmingCharacters(in: .whitespaces)
230+
let folderArg = (pathArg as NSString).expandingTildeInPath
231+
// Only a subcommand when the rest is a path — "/auto add the track from …" is a goal.
232+
let pathLike = (pathArg.hasPrefix("/") || pathArg.hasPrefix("~"))
233+
&& (!pathArg.contains(" ") || FileManager.default.fileExists(atPath: folderArg) || autoPilotParityFolders.contains(folderArg))
234+
if (isAddCmd || lower.hasPrefix("remove ")) && pathLike {
235+
let isAdd = isAddCmd
236+
let folder = folderArg
232237
if isAdd {
233238
var isDir: ObjCBool = false
234239
guard FileManager.default.fileExists(atPath: folder, isDirectory: &isDir), isDir.boolValue else {

0 commit comments

Comments
 (0)