Skip to content

fix: only show 'Restart your IDE' message for IDE-embedded tools#1097

Open
mvanhorn wants to merge 2 commits into
Fission-AI:mainfrom
mvanhorn:fix/1067-openspec-restart-ide-message-conditional
Open

fix: only show 'Restart your IDE' message for IDE-embedded tools#1097
mvanhorn wants to merge 2 commits into
Fission-AI:mainfrom
mvanhorn:fix/1067-openspec-restart-ide-message-conditional

Conversation

@mvanhorn
Copy link
Copy Markdown

@mvanhorn mvanhorn commented May 15, 2026

Summary

After openspec init, the success screen always tells the user "Restart your IDE for slash commands to take effect." For CLI tools (Claude Code, Codex, Gemini CLI, etc.), there's no IDE to restart — the slash commands work as soon as the file exists. Add a requiresIdeRestart flag to each tool config; render the restart hint only for the tools where it actually applies (Cursor, Windsurf, Cline, Continue, RooCode, GitHub Copilot, etc.).

Why this matters

#1067 reports the confusing always-on message. The fix annotates each AIToolOption with a boolean and threads it through validateTools to the install flow, so the rendering knows which row needs the hint. Tools without an editor process (Claude Code, Codex, Crush, etc.) no longer surface the line.

Fixes #1067

AI was used for assistance.

Summary by CodeRabbit

  • Bug Fixes
    • Restart suggestions after openspec init are now targeted: shown only when an IDE-resident tool (e.g., Cursor, GitHub Copilot, Continue, Windsurf) is configured, not for all tool setups.
  • Chores
    • Changelog updated to document this fix.

Review Change Stack

@mvanhorn mvanhorn requested a review from TabishB as a code owner May 15, 2026 23:33
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 15, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e0ac2aae-e08c-4c0a-8027-53b07904a763

📥 Commits

Reviewing files that changed from the base of the PR and between 93ad6f5 and 4c7c8ac.

📒 Files selected for processing (1)
  • src/core/init.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/core/init.ts

📝 Walkthrough

Walkthrough

Init now marks certain tools as IDE-resident via a new requiresIdeRestart flag, threads that flag through validation and generation, and shows the IDE restart prompt only when a configured tool requires it; tests and the changeset were updated accordingly.

Changes

IDE restart prompt refinement

Layer / File(s) Summary
Configure IDE-resident tool metadata
src/core/config.ts
AIToolOption interface gains optional requiresIdeRestart field; the AI_TOOLS array is updated to explicitly mark IDE-resident tools (Cursor, GitHub Copilot, Continue, Windsurf, Cline, CoStrict, Amazon Q Developer, Junie, Kilo Code, RooCode, Trae) with requiresIdeRestart: true, leaving CLI-only tools unmarked.
Thread requiresIdeRestart through validation and output
src/core/init.ts
New SelectedTool internal type carries the requiresIdeRestart flag; validateTools now returns SelectedTool[] and populates the flag from tool definition; generateSkillsAndCommands accepts the richer tool type; the success UI logic changes to display restart instructions only when at least one configured tool has requiresIdeRestart set, rather than for any tool creation/refresh.
Tests and changelog
test/core/init.test.ts, .changeset/restart-ide-hint.md
New test cases verify CLI-only tool initialization ("claude") excludes the restart message while IDE-resident tool initialization ("cursor") includes it; getConsoleOutput() helper extracts flattened mocked console output for assertions; changeset documents the fix.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

  • Fission-AI/OpenSpec#323: Both PRs modify the restart messaging logic in src/core/init.ts—the prior PR adds restart instructions generally, while this PR narrows the condition to tools with requiresIdeRestart set.

Poem

🐰 I hopped the config, nose so bright,
marking Cursor, Copilot in the night.
"Restart?" they ask — only some must do,
Claude stays quiet — CLI through and through.
A tiny carrot cheer for tests anew.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main change: adding conditional logic to only show the restart IDE message for IDE-embedded tools rather than all tools.
Linked Issues check ✅ Passed The PR addresses issue #1067 by implementing the requiresIdeRestart flag to conditionally display the restart message only for IDE-resident tools, directly resolving the reported problem.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the restart message behavior: updating AIToolOption interface, configuring the flag for specific tools, threading it through validation and display logic, and adding tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/core/init.ts (1)

635-647: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Type mismatch: parameter type must include requiresIdeRestart field.

The tools parameter is typed as Array<{ value: string; name: string; skillsDir: string; wasConfigured: boolean }>, which lacks the requiresIdeRestart field. However, at line 730, the code accesses tool.requiresIdeRestart on objects derived from results.createdTools and results.refreshedTools, which are typed as typeof tools.

This creates a type safety issue where the code accesses a property not present in the declared type. While it works at runtime (because the actual objects passed are SelectedTool[] instances that include this field), it violates TypeScript's type guarantees.

🔧 Suggested fix

Replace the inline anonymous type with SelectedTool[]:

  private displaySuccessMessage(
    projectPath: string,
-   tools: Array<{ value: string; name: string; skillsDir: string; wasConfigured: boolean }>,
+   tools: SelectedTool[],
    results: {
      createdTools: typeof tools;
      refreshedTools: typeof tools;

This ensures the parameter type accurately reflects the properties accessed in the method body and maintains type safety.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/core/init.ts` around lines 635 - 647, The tools parameter type for
displaySuccessMessage is missing the requiresIdeRestart field, causing a type
mismatch when accessing tool.requiresIdeRestart on results.createdTools and
results.refreshedTools; update the parameter and related result types to use the
existing SelectedTool type (e.g., change tools: Array<{...}> to tools:
SelectedTool[] and ensure results.createdTools / results.refreshedTools are
typed as SelectedTool[]), so the method signature accurately reflects the
properties used inside displaySuccessMessage.
🧹 Nitpick comments (1)
test/core/init.test.ts (1)

195-209: ⚡ Quick win

Good test coverage for the basic scenarios.

The tests correctly verify that CLI-only tools don't trigger the restart message while IDE-resident tools do. The test cases use appropriate representative tools (claude and cursor) that align with the configuration changes.

💡 Optional: Add test for mixed tool scenario

Consider adding a test case that configures both a CLI tool and an IDE-resident tool simultaneously to verify that the restart message is shown when at least one tool requires it:

it('should suggest an IDE restart when configuring mixed CLI and IDE tools', async () => {
  const initCommand = new InitCommand({ tools: 'claude,cursor', force: true });

  await initCommand.execute(testDir);

  expect(getConsoleOutput()).toContain('Restart your IDE for slash commands to take effect.');
});

This would provide additional confidence that the .some() logic correctly handles mixed scenarios.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/core/init.test.ts` around lines 195 - 209, Add a test that verifies
mixed tool lists (CLI + IDE-resident) trigger the restart message: create an
InitCommand with tools set to a combined string like 'claude,cursor' (or use the
same constructor pattern as the existing tests) and call
InitCommand.execute(testDir), then assert getConsoleOutput().toContain('Restart
your IDE for slash commands to take effect.'); this ensures the logic in
InitCommand.execute that checks tool types (.some() or equivalent) correctly
shows the restart prompt when at least one IDE-resident tool (e.g., 'cursor') is
present alongside a CLI-only tool (e.g., 'claude').
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/core/init.ts`:
- Around line 635-647: The tools parameter type for displaySuccessMessage is
missing the requiresIdeRestart field, causing a type mismatch when accessing
tool.requiresIdeRestart on results.createdTools and results.refreshedTools;
update the parameter and related result types to use the existing SelectedTool
type (e.g., change tools: Array<{...}> to tools: SelectedTool[] and ensure
results.createdTools / results.refreshedTools are typed as SelectedTool[]), so
the method signature accurately reflects the properties used inside
displaySuccessMessage.

---

Nitpick comments:
In `@test/core/init.test.ts`:
- Around line 195-209: Add a test that verifies mixed tool lists (CLI +
IDE-resident) trigger the restart message: create an InitCommand with tools set
to a combined string like 'claude,cursor' (or use the same constructor pattern
as the existing tests) and call InitCommand.execute(testDir), then assert
getConsoleOutput().toContain('Restart your IDE for slash commands to take
effect.'); this ensures the logic in InitCommand.execute that checks tool types
(.some() or equivalent) correctly shows the restart prompt when at least one
IDE-resident tool (e.g., 'cursor') is present alongside a CLI-only tool (e.g.,
'claude').

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1c01042a-f725-4715-9f72-bb3b1ec0e98f

📥 Commits

Reviewing files that changed from the base of the PR and between 8498042 and 93ad6f5.

📒 Files selected for processing (4)
  • .changeset/restart-ide-hint.md
  • src/core/config.ts
  • src/core/init.ts
  • test/core/init.test.ts

displaySuccessMessage accessed tool.requiresIdeRestart on objects derived
from results.createdTools / results.refreshedTools, but the parameter type
was an inline anonymous shape that didn't include the field. Use the
existing SelectedTool type so the access is type-safe.
@mvanhorn mvanhorn force-pushed the fix/1067-openspec-restart-ide-message-conditional branch from 1365267 to 4c7c8ac Compare May 16, 2026 00:35
@mvanhorn
Copy link
Copy Markdown
Author

Addressed in 4c7c8ac:

  • init.ts:635-647 (Major outside-diff) - typed tools parameter as SelectedTool[] instead of the inline anonymous shape. results.createdTools and results.refreshedTools now use the same type so tool.requiresIdeRestart access at the call site is type-safe.
  • Tests: 45 init tests still pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Restart your IDE for slash commands to take effect.

1 participant