Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/commands/suggest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,12 @@ export async function suggestCommand(
}

if (shouldCommit) {
await acceptAndCommit(selected, config, diffResult.diff);
} else {
if (!diffResult.staged) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P3: The new staged-change guard is misindented (2-space indent and } else { at column 0 inside a 6-space nesting), so npm run format:check fails and the PR cannot pass the format gate. Reindent the block to match the surrounding nesting.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/commands/suggest.ts, line 391:

<comment>The new staged-change guard is misindented (2-space indent and `} else {` at column 0 inside a 6-space nesting), so `npm run format:check` fails and the PR cannot pass the format gate. Reindent the block to match the surrounding nesting.</comment>

<file context>
@@ -388,8 +388,12 @@ export async function suggestCommand(
       if (shouldCommit) {
-        await acceptAndCommit(selected, config, diffResult.diff);
-      } else {
+  if (!diffResult.staged) {
+    outro(pc.red('Commit requires staged changes. Stage your changes with `git add` and try again.'));
+    return;
</file context>

outro(pc.red('Commit requires staged changes. Stage your changes with `git add` and try again.'));
return;
}
await acceptAndCommit(selected, config, diffResult.diff);
} else {
Comment on lines +391 to +396

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: The new if (!diffResult.staged) block and its closing } else { are indented at column 0 instead of inside the enclosing if (shouldCommit) block, breaking the repo's Prettier convention. npx prettier src/commands/suggest.ts reformats lines 391-396, and npm run format:check will fail on this file. Indent the block and closing brace to 8 spaces.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/commands/suggest.ts, line 391:

<comment>The new `if (!diffResult.staged)` block and its closing `} else {` are indented at column 0 instead of inside the enclosing `if (shouldCommit)` block, breaking the repo's Prettier convention. `npx prettier src/commands/suggest.ts` reformats lines 391-396, and `npm run format:check` will fail on this file. Indent the block and closing brace to 8 spaces.</comment>

<file context>
@@ -388,8 +388,12 @@ export async function suggestCommand(
       if (shouldCommit) {
-        await acceptAndCommit(selected, config, diffResult.diff);
-      } else {
+  if (!diffResult.staged) {
+    outro(pc.red('Commit requires staged changes. Stage your changes with `git add` and try again.'));
+    return;
</file context>
Suggested change
if (!diffResult.staged) {
outro(pc.red('Commit requires staged changes. Stage your changes with `git add` and try again.'));
return;
}
await acceptAndCommit(selected, config, diffResult.diff);
} else {
if (!diffResult.staged) {
outro(pc.red('Commit requires staged changes. Stage your changes with `git add` and try again.'));
return;
}
await acceptAndCommit(selected, config, diffResult.diff);
} else {

console.log(`\n ${pc.green('Selected:')} ${pc.bold(selected.message)}`);
if (selected.body) {
console.log(` ${pc.dim(selected.body)}`);
Expand Down