Skip to content

fix: smart uninstaller cleanup + prevent nested .ragcode dirs#48

Merged
doITmagic merged 4 commits intodevfrom
fix/uninstaller-smart-cleanup
Apr 1, 2026
Merged

fix: smart uninstaller cleanup + prevent nested .ragcode dirs#48
doITmagic merged 4 commits intodevfrom
fix/uninstaller-smart-cleanup

Conversation

@doITmagic
Copy link
Copy Markdown
Owner

Description

Eliminates incomplete uninstallation caused by hardcoded directory guesses (~/Projects, ~/code, etc.). Replaces with a data-driven strategy that queries every authoritative source available on the system. Also fixes the root cause of nested .ragcode/ directories being created when IDEs open sub-directories.

Changes:

  • internal/uninstall/uninstall.go — cleanup from 4 sources: registry, Qdrant file_path payloads, JetBrains/VSCode/AI-IDE configs (resolveIDEPaths), shallow $HOME scan
  • internal/uninstall/uninstall_test.go — updated tests for orphan sibling detection
  • pkg/workspace/detector/detector.go — removed .ragcode from workspace markers (prevented hijacking root detection)
  • pkg/workspace/resolver/resolver.go — centralized applyNestedOverride to prevent split-indexing on sub-directory opens

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have performed a self-review of my own code
  • I have formatted my code with go fmt ./...
  • I have run tests go test ./... and they pass
  • I have verified integration with Ollama/Qdrant (if applicable)
  • I have updated the documentation accordingly

- Uninstaller derives scan roots from registry, Qdrant file_path payloads,
  JetBrains/VSCode/AI-IDE configs — no more hardcoded directory guessing
- findWorkspaceRootFromFilePath: walk up from Qdrant payload to workspace root
- detectIDEProjectParents: reads recentProjects.xml, storage.json, resolveIDEPaths
- detector: removed .ragcode from workspace markers (prevents hijacking root detection)
- resolver: applyNestedOverride centralized — prevents split-indexing on sub-dirs
Copilot AI review requested due to automatic review settings March 30, 2026 06:54
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves uninstall completeness by replacing hardcoded directory guesses with data-driven discovery (registry, Qdrant payloads, IDE configs, shallow home scan) and reduces accidental creation of nested .ragcode/ directories by adjusting workspace detection/resolution.

Changes:

  • Expand uninstall cleanup strategy to scan authoritative sources (registry + Qdrant + IDE configs + home shallow scan).
  • Remove .ragcode as a workspace marker and centralize nested-workspace override logic in the resolver.
  • Update uninstall tests and bump CLI version.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
internal/uninstall/uninstall.go New discovery-based scanning for orphaned .ragcode/ dirs; IDE/Qdrant-based root discovery.
internal/uninstall/uninstall_test.go Updates expectations to reflect fallback scan cleanup.
pkg/workspace/detector/detector.go Removes .ragcode from marker list to avoid workspace root “hijacking”.
pkg/workspace/resolver/resolver.go Centralizes nested workspace override via applyNestedOverride.
cmd/rag-code-mcp/main.go Version bump to 2.1.87.
Comments suppressed due to low confidence (1)

pkg/workspace/detector/detector.go:62

  • Removing ".ragcode" from the marker list means detectFromMetadata() can now fail for workspaces that only have the managed .ragcode/root metadata (and no other markers like .git/go.mod). That makes previously indexable “markerless” folders undiscoverable and will return "metadata referenced root ... but no markers found". Consider treating the metadata file itself as sufficient, or adding a dedicated marker check for .ragcode/root without reintroducing .ragcode directory hijacking.
			"artisan",
			".agent",
			".idea",
			".vscode",
			".vs",
			".cursor",
			".windsurf",
			"AGENTS.md",
			"CLAUDE.md",
		},
		MaxDepth:         10,
		MetadataFileName: filepath.Join(".ragcode", "root"),
	}

@doITmagic doITmagic self-assigned this Apr 1, 2026
@doITmagic
Copy link
Copy Markdown
Owner Author

Verified this and you're correct. Updated inspectDir to explicitly treat the .ragcode/root metadata file as a valid marker so markerless workspaces remain discoverable.

Copilot AI review requested due to automatic review settings April 1, 2026 04:51
@doITmagic
Copy link
Copy Markdown
Owner Author

Fixed. Added curl timeouts in Qdrant fetches, corrected the off-by-one depth limit and the IDE data dir sentinel, and explicitly lowered Confidence/Reason when applying a nested workspace outline fallback.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

@doITmagic
Copy link
Copy Markdown
Owner Author

Addressed the final two items: Gated the SkipDir return flag behind info.IsDir() so file walkers don't unnecessarily panic-abort when hitting deep configurations, and fully restored the IDE grandparent directory parsing to include both the configuration and umbrella projects directory.

@doITmagic doITmagic merged commit cedb109 into dev Apr 1, 2026
5 checks passed
@doITmagic doITmagic deleted the fix/uninstaller-smart-cleanup branch April 1, 2026 06:01
@doITmagic doITmagic mentioned this pull request Apr 1, 2026
9 tasks
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.

2 participants