Skip to content

feat: add support for cursor cli #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

35C4n0r
Copy link
Collaborator

@35C4n0r 35C4n0r commented Aug 12, 2025

@35C4n0r
Copy link
Collaborator Author

35C4n0r commented Aug 12, 2025

@hugodutka @matifali PR ready for review.

@matifali matifali requested a review from Copilot August 12, 2025 17:59
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@bpmct
Copy link
Member

bpmct commented Aug 12, 2025

@hugodutka are we good to merge here?

35C4n0r and others added 5 commits August 15, 2025 18:34
Co-authored-by: Cian Johnston <public@cianjohnston.ie>
Co-authored-by: Cian Johnston <public@cianjohnston.ie>
@35C4n0r
Copy link
Collaborator Author

35C4n0r commented Aug 15, 2025

@johnstcn thanks for the review, made the changes.

Comment on lines +154 to +156
if !strings.Contains(line, m) {
return currentIdx, false
}
Copy link
Member

@johnstcn johnstcn Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also relatively new to this codebase, so please let me know if I'm way off --
my understanding is that we want to match a "bottom line" of box-drawing characters.

This approach could potentially incorrectly match a line similar to:

Hello (╯▽╰) this is my custom agent 

Would a better approach be to check that the string trimmed of leading and trailing whitespace starts or and ends with the given characters?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@johnstcn

check that the string trimmed of leading and trailing whitespace starts or and ends with the given characters?

makes sense, will add that.

Anyhow the logic above it

	msg, msgLines, msgRuneLineLocations := normalizeAndGetRuneLineMapping(msgRaw)
	userInput, _, userInputLineLocations := normalizeAndGetRuneLineMapping(userInputRaw)
	userInputStartIdx := findUserInputStartIdx(msg, msgRuneLineLocations, userInput, userInputLineLocations)

	if userInputStartIdx == -1 {
		// The user input prefix was not found in the message prefix
		// Return the original message
		return msgRaw
	}

	userInputEndIdx := findUserInputEndIdx(userInputStartIdx, msg, userInput)

	// Return the original message starting with the first line
	// that doesn't contain the echoed user input.
	lastUserInputLineIdx := msgRuneLineLocations[userInputEndIdx]

to get the lastUserInputLineIdx tries it's best to make sure we are getting the line that is right after the user input message ends. Can't think of a case where the next line to the user input (in case of gemini and codex in which the behaviour is known) is going to be anything other than the end line.

PS: This got me thinking, the matching logic was initially there because I didn't have access to the agent type in the RemoveUserInput, since I do that now, I think we can just skip the next line (since the behaviour is known ?), wdyt ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants