Skip to content

Add doctor actions for skill path overlap warnings#180

Merged
runkids merged 1 commit into
runkids:mainfrom
PeterTianbuhan:codex/doctor-overlap-suggestions
May 31, 2026
Merged

Add doctor actions for skill path overlap warnings#180
runkids merged 1 commit into
runkids:mainfrom
PeterTianbuhan:codex/doctor-overlap-suggestions

Conversation

@PeterTianbuhan
Copy link
Copy Markdown
Contributor

Implemented actionable remediation guidance for doctor warnings that already detect shared target paths and cross-target discovery overlap.

The text output now shows a concrete Action: line for each overlap, including the involved targets and the safe skillshare target remove <name> --dry-run preview path. The JSON output also exposes an optional action field so UI and automation can surface the same guidance.

This keeps the existing detection behavior unchanged. It does not implement the full adopt/claim workflow from #135; it only makes the current duplicate-root diagnostics more actionable.

Refs #135

Tests:

  • go test ./cmd/skillshare -run 'TestCheckSharedTargetPaths|TestCheckCrossTargetDiscovery|TestDoctorCheckActionJSON'
  • go test ./tests/integration -run 'TestDoctor_SharedDiscoveryShowsAction|TestDoctor_JSON_SharedDiscoveryIncludesAction'
  • ./scripts/test.sh --quiet

Copilot AI review requested due to automatic review settings May 31, 2026 13:23
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

Note

Copilot was unable to run its full agentic suite in this review.

Adds an action field to Doctor checks and validates it via unit + integration tests so users get clearer remediation guidance for cross-target discovery/shared-path warnings.

Changes:

  • Extend Doctor JSON schema/result model to include an optional action field.
  • Emit and test remediation guidance for shared-path collisions and cross-target discovery.
  • Add/extend unit and integration tests to assert action presence in both text and JSON output.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
tests/integration/doctor_test.go Adds integration coverage asserting Action: is shown in CLI output and present in --json output.
cmd/skillshare/doctor_shared_paths_test.go Ensures produced warnings now include non-empty Action.
cmd/skillshare/doctor_shared_paths.go Introduces action strings and prints remediation guidance; wires action into Doctor checks.
cmd/skillshare/doctor_json_test.go Adds unit test asserting action is included when marshaling Doctor JSON.
cmd/skillshare/doctor_json.go Adds Action field to the doctorCheck JSON type.
cmd/skillshare/doctor.go Adds addCheckWithAction and routes existing addCheck through it.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmd/skillshare/doctor_shared_paths.go Outdated
details := make([]string, 0, len(collisions))
for _, c := range collisions {
ui.Warning("Shared path %s ← %s", c.path, strings.Join(c.targets, ", "))
fmt.Println(ui.DimText(" Action: " + sharedTargetPathsRemediation(c.targets)))
Comment thread cmd/skillshare/doctor_shared_paths.go Outdated
details = append(details, fmt.Sprintf("%s (%s) also scans %s ← %s",
so.scanner, so.scannerPath, p.sharedPath, strings.Join(p.writers, ", ")))
}
fmt.Println(ui.DimText(" Action: " + crossTargetDiscoveryRemediation(so.scanner, writers)))
Comment thread cmd/skillshare/doctor_shared_paths.go Outdated
Comment on lines +13 to +16
const (
sharedTargetPathsAction = "Choose one authoritative target for each shared directory; remove or reconfigure the other target(s) before syncing."
crossTargetDiscoveryAction = "Choose one authoritative route for each overlapping runtime; remove or reconfigure duplicate targets, or exclude overlapping skills from one side before syncing."
)
Comment thread cmd/skillshare/doctor_shared_paths.go Outdated

msg := fmt.Sprintf("%d shared target path(s) — enabled targets writing to the same directory may produce duplicate skills in runtime pickers", len(collisions))
result.addCheck("shared_target_paths", checkWarning, msg, details)
result.addCheckWithAction("shared_target_paths", checkWarning, msg, details, sharedTargetPathsAction)
Comment thread cmd/skillshare/doctor_shared_paths.go Outdated

msg := fmt.Sprintf("%d target(s) overlap with other targets' content via cross-runtime discovery", len(scannerNames))
result.addCheck("cross_target_discovery", checkWarning, msg, details)
result.addCheckWithAction("cross_target_discovery", checkWarning, msg, details, crossTargetDiscoveryAction)
sb := testutil.NewSandbox(t)
defer sb.Cleanup()

os.MkdirAll(filepath.Join(sb.Home, ".agents", "skills"), 0755)
sb := testutil.NewSandbox(t)
defer sb.Cleanup()

os.MkdirAll(filepath.Join(sb.Home, ".agents", "skills"), 0755)
Comment on lines +45 to +53
out := buildDoctorOutput(result)
data, err := json.Marshal(out)
if err != nil {
t.Fatal(err)
}

if !strings.Contains(string(data), `"action":"Choose one authoritative route."`) {
t.Fatalf("doctor JSON missing action field: %s", data)
}
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces actionable remediation guidance to the doctor command when detecting shared target paths or cross-target discovery overlaps. It adds an Action field to the doctor check results, updates the CLI output to display these actions, includes them in the JSON output, and adds corresponding unit and integration tests to verify the new behavior. There are no review comments, and the changes look solid, so I have no additional feedback to provide.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 141bf518e9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cmd/skillshare/doctor_shared_paths.go Outdated
)

func sharedTargetPathsRemediation(targets []string) string {
return fmt.Sprintf("Choose one authoritative target from %s; preview removing duplicate targets with `skillshare target remove <name> --dry-run`.",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include the doctor mode in target removal actions

When skillshare doctor --global is run from inside a directory that has a project config, this suggested command does not operate on the same config that doctor just checked: cmdTarget leaves the command in auto mode and resolves auto mode to project whenever projectConfigExists(cwd) is true (cmd/skillshare/target.go lines 35-40). In that context the user will preview or later remove a project target instead of the global duplicate target being reported; pass the current doctor mode into the remediation and include --global/--project in these target-removal suggestions.

Useful? React with 👍 / 👎.

@runkids
Copy link
Copy Markdown
Owner

runkids commented May 31, 2026

Thanks for this, @PeterTianbuhan! 🙏

Heads-up: this overlaps with #177, which landed on main slightly earlier and implements the same #135 remediation guidance — it added an optional suggestions array to each doctor check (carrying the involved target names) plus the suggestion: lines in the text output. We've since followed up with docs for the JSON field and rendering of those suggestions on the web dashboard's Health Check page, which is why GitHub now flags this PR as conflicting.

That said, one part of your PR is genuinely nicer than what we merged: surfacing the concrete skillshare target remove <name> --dry-run command in the remediation text. Our current wording is more generic ("disable or reconfigure the rest"), so we'd love to keep that idea.

Would you be up for rebasing onto the latest main and resubmitting just that focused improvement — folding the target remove … --dry-run hint (and your integration tests, which we'd also welcome) into the existing suggestions field? That avoids a second parallel action field for the same purpose, and keeps the credit yours.

Happy to help if anything about the merged structure is unclear. Thanks again for digging into #135!

@PeterTianbuhan PeterTianbuhan force-pushed the codex/doctor-overlap-suggestions branch from 141bf51 to 1caa32b Compare May 31, 2026 14:09
@runkids runkids merged commit 50e6cb8 into runkids:main May 31, 2026
7 of 8 checks passed
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.

3 participants