-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat: watch mode #564
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
base: main
Are you sure you want to change the base?
feat: watch mode #564
Conversation
All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
27129c0
to
3945241
Compare
5dc1714
to
35c645d
Compare
Hey @tibo-openai, just pushed a minor change. Let me know your feedback - happy to help with anything! |
any chance this could make it in? it'd be huge for my workflows w/ |
I would suggest we have a much more specific and possibly incorrect syntax wise (how does this work on all languages?) way of triggering this, and does it watch folders? if so -- maybe using watchman is the better idea. I worry that valid comments which are so broad (or could be written as a joke even) could be bad. but like: %codex "fix this", "o3"
fun test(input: String) -> String %codex "fix this", "o3"
def test(input: str) str: could be a better idea -- and not tied syntactically |
I think the general idea is that you write the comment in whatever language you're working on, and it's indexing on "AI!" (I didn't author this/might be misunderstanding the concern -- I don't have very strong opinions on the syntax personally) so |
+1 @lostmygithubaccount that is exactly the idea! I'm already using this daily and it's a game changer, at least for my workflow. As per the suffix, I could tweak it with @eric-humane I see your point about a "custom" format for the trigger, although I'm not convinced because it breaks the syntax of the files I'm working on. IMHO having a custom suffix in normal comments, ie. Regarding |
and I agree with yours, but maybe the trigger isn't natural to you. but seeing it as
Ex-react / react-native engineer, it's just what I am used to lol.
|
34bb341
to
7c95c16
Compare
Thanks all for sharing your thoughts! I've given some love to this PR that now supports defining a custom trigger regular expression in the
with this config:
TLDR: The default trigger remains What do you think? |
27e8c7d
to
4fdd35f
Compare
I still think using an open ended default trigger isn't a great idea, but like @agustif suggestion as a default. Because // AI:TODO
// AI:FIXME similarly:
is extremely clear :P |
343457c
to
499c33f
Compare
Thanks for your input!
I've updated the default pattern to Do you have any further feedback for the first version of this enhancement? |
7c1db1e
to
1ea6dea
Compare
… extraction functions
1ea6dea
to
7cd6a45
Compare
closes: #565
This PR introduces a
watch mode
feature that enables Codex to passively monitor the code base for AI triggering comments (default is:// CODEX: <instruction>
). When a trigger comment is detected Codex will grab the surrounding context, filename, and execute the instruction.In the video below we open
nvim
on the right, andcodex
on the left with--watch
flag enabled:video.mp4
What
Customizable AI Trigger Detection
// CODEX: fix this bug
config.json
:// AI:TODO fix this function
for integration with task management workflowsAutomatic context extraction
This mode automatically injects the context around the trigger comment and relative file in the prompt;
Comprehensive Comment Style Support
Works with various single-line comment formats across programming languages:
Efficient file monitoring
Uses
chokidar
for performant file watching with intelligent filteringWhy
This feature reduces workflow disruptions by enabling Codex interoperability in any editor.
How
Then in any code file, add comments with your preferred trigger pattern:
Default pattern (
// CODEX: fix this
)Task-based pattern (with custom config)
With pattern:
/(?:\\/\\/|#)\\s*AI:(TODO|FIXME)\\s+(.*)/i
Custom keyword pattern (with custom config)
With pattern:
/(?:\\/\\/|#)\\s*(.*)\\s*codex[!?]/i