fix(cli): check publish command at argv[2] position only#468
Merged
jahooma merged 1 commit intoCodebuffAI:mainfrom Mar 9, 2026
Merged
fix(cli): check publish command at argv[2] position only#468jahooma merged 1 commit intoCodebuffAI:mainfrom
jahooma merged 1 commit intoCodebuffAI:mainfrom
Conversation
The CLI's publish command detection used process.argv.includes('publish')
which matches 'publish' anywhere in the arguments, not just as a subcommand.
This means a user prompt like 'publish my changes' triggers the publish
flow and exits the session instead of starting a chat.
The fix makes isPublishCommand consistent with isLoginCommand by checking
only argv[2] (the subcommand position).
Before:
codebuff "publish my changes"
# triggers handlePublish() and exits
After:
codebuff "publish my changes"
# starts a chat session with the prompt
Fixes CodebuffAI#465
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes publish command detection to only match when 'publish' is the actual subcommand, not anywhere in the arguments.
Problem
The CLI's publish command detection uses
process.argv.includes('publish')which matches "publish" anywhere in the arguments, not just as a subcommand. A user prompt like "publish my changes" triggers the publish flow and exits the session.isLoginCommandcorrectly checks onlyargv[2](the subcommand position), butisPublishCommandusesincludes()which matches any argument.Reproduction
Fix
Consistent with how
isLoginCommandis detected.Fixes #465