Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 0 additions & 2 deletions apps/server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import { createEnhancePromptRoutes } from './routes/enhance-prompt/index.js';
import { createWorktreeRoutes } from './routes/worktree/index.js';
import { createGitRoutes } from './routes/git/index.js';
import { createSetupRoutes } from './routes/setup/index.js';
import { createSuggestionsRoutes } from './routes/suggestions/index.js';
import { createModelsRoutes } from './routes/models/index.js';
import { createRunningAgentsRoutes } from './routes/running-agents/index.js';
import { createWorkspaceRoutes } from './routes/workspace/index.js';
Expand Down Expand Up @@ -331,7 +330,6 @@ app.use('/api/auto-mode', createAutoModeRoutes(autoModeService));
app.use('/api/enhance-prompt', createEnhancePromptRoutes(settingsService));
app.use('/api/worktree', createWorktreeRoutes(events, settingsService));
app.use('/api/git', createGitRoutes());
app.use('/api/suggestions', createSuggestionsRoutes(events, settingsService));
app.use('/api/models', createModelsRoutes());
app.use('/api/spec-regeneration', createSpecRegenerationRoutes(events, settingsService));
app.use('/api/running-agents', createRunningAgentsRoutes(autoModeService));
Expand Down
16 changes: 10 additions & 6 deletions apps/server/src/providers/cursor-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,11 @@ export class CursorProvider extends CliProvider {
'--stream-partial-output' // Real-time streaming
);

// Only add --force if NOT in read-only mode
// Without --force, Cursor CLI suggests changes but doesn't apply them
// With --force, Cursor CLI can actually edit files
if (!options.readOnly) {
// In read-only mode, use --mode ask for Q&A style (no tools)
// Otherwise, add --force to allow file edits
if (options.readOnly) {
cliArgs.push('--mode', 'ask');
} else {
cliArgs.push('--force');
}

Expand Down Expand Up @@ -672,10 +673,13 @@ export class CursorProvider extends CliProvider {
);
}

// Embed system prompt into user prompt (Cursor CLI doesn't support separate system messages)
const effectiveOptions = this.embedSystemPromptIntoPrompt(options);

// Extract prompt text to pass via stdin (avoids shell escaping issues)
const promptText = this.extractPromptText(options);
const promptText = this.extractPromptText(effectiveOptions);

const cliArgs = this.buildCliArgs(options);
const cliArgs = this.buildCliArgs(effectiveOptions);
const subprocessOptions = this.buildSubprocessOptions(options, cliArgs);
Comment on lines +676 to 683
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# First, let's understand the repository structure
find . -type f -name "*.ts" -path "*provider*" | head -20

Repository: AutoMaker-Org/automaker

Length of output: 1056


🏁 Script executed:

#!/bin/bash
# Search for buildSubprocessOptions implementation
rg -n "buildSubprocessOptions" --type ts -A 30 | head -100

Repository: AutoMaker-Org/automaker

Length of output: 8649


🏁 Script executed:

#!/bin/bash
# Also check the cursor-provider.ts file specifically
rg -n "buildSubprocessOptions|buildCliArgs|extractPromptText" apps/server/src/providers/cursor-provider.ts

Repository: AutoMaker-Org/automaker

Length of output: 400


🏁 Script executed:

#!/bin/bash
# Get the full buildSubprocessOptions implementation from cli-provider.ts
sed -n '446,545p' apps/server/src/providers/cli-provider.ts

Repository: AutoMaker-Org/automaker

Length of output: 3390


🏁 Script executed:

#!/bin/bash
# Also check if there are any prompt-related field accesses in buildSubprocessOptions
rg -n "options\." apps/server/src/providers/cli-provider.ts | grep -A 5 -B 5 "buildSubprocessOptions" | head -50

Repository: AutoMaker-Org/automaker

Length of output: 49


🏁 Script executed:

#!/bin/bash
# Get the complete buildSubprocessOptions method from cli-provider
ast-grep --pattern 'protected buildSubprocessOptions($_, $_) {
  $$$
}'

Repository: AutoMaker-Org/automaker

Length of output: 49


🏁 Script executed:

#!/bin/bash
# Check if cursor-provider extends cli-provider and what it overrides
head -50 apps/server/src/providers/cursor-provider.ts

Repository: AutoMaker-Org/automaker

Length of output: 1569


🏁 Script executed:

#!/bin/bash
# Check if cursor-provider has its own buildSubprocessOptions override
rg -n "buildSubprocessOptions" apps/server/src/providers/cursor-provider.ts

Repository: AutoMaker-Org/automaker

Length of output: 147


🏁 Script executed:

#!/bin/bash
# Check the class hierarchy and imports in cursor-provider
rg -n "class CursorProvider|extends|import" apps/server/src/providers/cursor-provider.ts | head -20

Repository: AutoMaker-Org/automaker

Length of output: 683


🏁 Script executed:

#!/bin/bash
# Check what embedSystemPromptIntoPrompt does and what it returns
rg -n "embedSystemPromptIntoPrompt" apps/server/src/providers/cursor-provider.ts -A 20

Repository: AutoMaker-Org/automaker

Length of output: 989


🏁 Script executed:

#!/bin/bash
# Also check the base class implementation
rg -n "embedSystemPromptIntoPrompt" apps/server/src/providers/cli-provider.ts -A 20

Repository: AutoMaker-Org/automaker

Length of output: 1669


🏁 Script executed:

#!/bin/bash
# Check the full executeQuery method in cursor-provider to understand the context better
sed -n '670,690p' apps/server/src/providers/cursor-provider.ts

Repository: AutoMaker-Org/automaker

Length of output: 1014


Pass effectiveOptions to buildSubprocessOptions for consistency with parent class.

Line 683 currently passes the original options to buildSubprocessOptions, while the parent class CliProvider (line 545) passes effectiveOptions. Although buildSubprocessOptions only accesses non-prompt fields (cwd, reasoningEffort, abortController) and thus the embedded system prompt is not bypassed, this inconsistency with the parent class pattern reduces maintainability. The prompt correctly flows through effectiveOptionspromptText → stdin, so change the call to this.buildSubprocessOptions(effectiveOptions, cliArgs) to align with the parent implementation.

🤖 Prompt for AI Agents
In `@apps/server/src/providers/cursor-provider.ts` around lines 676 - 683, The
call to buildSubprocessOptions uses the original options instead of the
normalized effectiveOptions, causing an inconsistency with the parent
CliProvider; update the call in the cursor provider so that after creating
effectiveOptions via embedSystemPromptIntoPrompt and building cliArgs with
buildCliArgs, you call this.buildSubprocessOptions(effectiveOptions, cliArgs)
(reference methods: embedSystemPromptIntoPrompt, extractPromptText,
buildCliArgs, buildSubprocessOptions, and class CliProvider) to align behavior
and improve maintainability.


// Pass prompt via stdin to avoid shell interpretation of special characters
Expand Down
34 changes: 0 additions & 34 deletions apps/server/src/routes/suggestions/common.ts

This file was deleted.

Loading