smartcat icon indicating copy to clipboard operation
smartcat copied to clipboard

Pipe-based workflows using multiple prompts

Open mlavrinenko opened this issue 7 months ago β€’ 5 comments

Great tool!

I have a feature idea how to extend its flexibility by providing ability to combine stdin input and user input with an option:

sc programmer "write a snake game" | sc reviewer "review the project: " --append-stdin

I can try to implement it if it looks good to you.

mlavrinenko avatar May 18 '25 17:05 mlavrinenko

Isn't that exactly what -r does?

dbosk avatar May 18 '25 18:05 dbosk

As I can see --repeat-input affects output so that it would include (prepend) initial prompt to the final output. I want to affect user input so that stdin and agrument inputs would be merged in some way (--append-stdin or --prepend-stdin).

Current workaround for the provided simple case:

echo "review the project: " > tmp.txt
sc programmer "write a snake game" >> tmp.txt
echo tmp.txt | sc reviewer

But if someone wants to pipe-chain 10 commands it would be unbearable. It's not the case where conversation-feature can help either, because I also don't want to store initial inputs for future inputs. i.e. I don't want to include "write a snake game" to second prompt where I request a review.

mlavrinenko avatar May 18 '25 19:05 mlavrinenko

Then I get it. I think it would be useful.

The only improvements to the current prompt I can do are the following two variants:

(echo "review the project: ";
 sc programmer "write a snake game") | sc reviewer

or

echo "review the project:
 `sc programmer "write a snake game"`" | sc reviewer

dbosk avatar May 19 '25 03:05 dbosk

I've made https://github.com/efugier/smartcat/pull/57 but that's just a starting point, because I'm not sure how to handle different cases if it's even possible. I need an opinion.

mlavrinenko avatar Jun 28 '25 21:06 mlavrinenko

Hey, sorry @mlavrinenko, been super busy lately. Thank you for your interest in the tool!

I'm not sure I understand what you are trying to do, how is not equivalent to:

❯ sc "write a sentence with typos" | sc empty "review the typos"
Here’s your corrected sentence with the typos fixed:

**"I received a letter yesterday that was quite important for my upcoming project."**

### Breakdown of corrections:
1. **"recieved" β†’ "received"** (correct spelling)
2. **"lettter" β†’ "letter"** (extra "t" removed)
3. **"yesturday" β†’ "yesterday"** (correct spelling)
4. **"quete" β†’ "quite"** (correct spelling)
5. **"importent" β†’ "important"** (correct spelling)
6. **"upcomming" β†’ "upcoming"** (correct spelling)
7. **"projct" β†’ "project"** (missing "e" added)

efugier avatar Oct 09 '25 15:10 efugier