Skip to content

feat: add copilot cli plugin detection to doctor command#40

Merged
kenryu42 merged 4 commits into
mainfrom
feat/add-copilot-cli-plugin-detection-to-doctor-command
Mar 24, 2026
Merged

feat: add copilot cli plugin detection to doctor command#40
kenryu42 merged 4 commits into
mainfrom
feat/add-copilot-cli-plugin-detection-to-doctor-command

Conversation

@kenryu42
Copy link
Copy Markdown
Owner

@kenryu42 kenryu42 commented Mar 24, 2026

Summary

  • Add Copilot CLI plugin detection to the doctor command via copilot plugin list
  • Doctor now detects when copilot-safety-net is installed as a Copilot CLI plugin, not just via hook config files
  • Simplify AGENTS.md check command description and add bun run check description to CLAUDE.md

Changes

  • src/bin/doctor/system-info.ts: Added copilot plugin list to the parallel version fetch calls; added hasCopilotSafetyNetPlugin() helper to parse plugin list output and detect the copilot-safety-net plugin ID; added copilotPluginInstalled boolean to SystemInfo return
  • src/bin/doctor/types.ts: Added copilotPluginInstalled: boolean field to SystemInfo interface and copilotPluginInstalled?: boolean to HookDetectOptions
  • src/bin/doctor/hooks.ts: Updated detectCopilotCliHook() to accept copilotPluginInstalled option; when plugin is installed, report status as 'configured' with method 'plugin list' even without hook config files
  • src/bin/doctor/index.ts: Pass copilotPluginInstalled from system info to detectAllHooks()
  • tests/bin/doctor/system-info.test.ts: Added tests for copilotPluginInstalled detection — true when plugin is listed, false for partial matches, false when unavailable
  • tests/bin/doctor/hooks.test.ts: Added tests for Copilot CLI plugin-based detection — configured via plugin list, override by disableAllHooks, and global hook config
  • tests/bin/doctor/format.test.ts: Added copilotPluginInstalled: true to test fixture
  • tests/helpers.ts: Updated mockVersionFetcher to handle copilot plugin list args and return mock plugin list output
  • AGENTS.md: Simplified bun run check description
  • CLAUDE.md: Added bun run check description for consistency

Testing

bun run check
bun src/bin/cc-safety-net.ts doctor

PR Checklist

  • I have read the CONTRIBUTING.md
  • Code follows project conventions (type hints, naming, etc.)
  • bun run check passes (lint, types, dead code, rules, tests)
  • Tests added for new rules (minimum 90% coverage required)
  • Tested locally with Claude Code, OpenCode, Gemini CLI or GitHub Copilot CLI
  • Updated documentation if needed (README, AGENTS.md)
  • No version changes in package.json

Summary by CodeRabbit

  • New Features

    • Diagnostics now detect a specific Copilot plugin and surface its presence in hook/status reporting.
  • Documentation

    • Contributor guidance updated to require the unified validation command (runs checks together); architecture section removed.
  • Tests

    • Test coverage and fixtures updated to cover the new plugin-detection behavior and related outputs.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f2a5a2f7-8613-4085-864d-11e9a5a2abcf

📥 Commits

Reviewing files that changed from the base of the PR and between 5285a37 and fb42d6d.

⛔ Files ignored due to path filters (1)
  • dist/bin/cc-safety-net.js is excluded by !**/dist/**
📒 Files selected for processing (2)
  • src/bin/doctor/hooks.ts
  • tests/bin/doctor/hooks.test.ts
✅ Files skipped from review due to trivial changes (1)
  • tests/bin/doctor/hooks.test.ts

📝 Walkthrough

Walkthrough

The PR adds Copilot plugin detection by running copilot plugin list, exposes copilotPluginInstalled in system info/types, threads that flag into hook detection so Copilot can be reported as configured via method: 'plugin list', and updates docs and tests to require/reflect using bun run check and the new system field.

Changes

Cohort / File(s) Summary
Documentation
AGENTS.md, CLAUDE.md
Reworded guidance to require using bun run check (typecheck, knip, Biome lint, tests) and removed the src/ Architecture section from AGENTS.md.
System Info Detection
src/bin/doctor/system-info.ts, src/bin/doctor/types.ts
Run copilot plugin list, add non-exported hasCopilotSafetyNetPlugin helper, include copilotPluginInstalled: boolean in SystemInfo, and surface raw plugin-list output for detection.
Hook Detection Logic
src/bin/doctor/hooks.ts, src/bin/doctor/index.ts
Add copilotPluginInstalled?: boolean to HookDetectOptions; when true, detectAllHooks may mark Copilot status: 'configured' with method: 'plugin list', use COPILOT_PLUGIN_CONFIG_PATH fallback for configPath, and make configPaths undefined when none found; runDoctor now passes system.copilotPluginInstalled.
Tests & Mocks
tests/bin/doctor/..., tests/helpers.ts
Updated fixtures to include copilotPluginInstalled; added tests for plugin-present/absent/partial matches and behavior when settings disable hooks; mockVersionFetcher now handles ['copilot','plugin', ...] output.
Formatting Tests
tests/bin/doctor/format.test.ts
Added copilotPluginInstalled: false to mocked system objects used by formatter tests.

Sequence Diagram(s)

sequenceDiagram
    participant Runner as Doctor Runner
    participant Sys as System Info
    participant Copilot as Copilot CLI
    participant Hooks as Hook Detection

    Runner->>Sys: getSystemInfo()
    Sys->>Copilot: copilot plugin list
    Copilot-->>Sys: plugin list output
    Sys->>Sys: hasCopilotSafetyNetPlugin(output)
    Sys-->>Runner: { copilotPluginInstalled: boolean, ... }

    Runner->>Hooks: detectAllHooks({ copilotPluginInstalled, ... })
    alt copilotPluginInstalled === true
        Hooks->>Hooks: mark Copilot configured via plugin
        Hooks-->>Runner: { status: "configured", method: "plugin list", configPath: "copilot-plugin" | path, configPaths: undefined | [...] }
    else
        Hooks->>Hooks: inspect local hook config files
        Hooks-->>Runner: { status: "...", method: "hook config", configPath: "path", configPaths: [...] }
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Doctor command #22: Modifies doctor command codepaths and related tests/types; overlaps Copilot detection changes.
  • feat: copilot cli doctor #35: Alters doctor hook-detection and system-info handling for Copilot/version gating; closely related to these changes.

Poem

🐰 I hopped through CLI lines late last night,
Found a safety-net plugin glowing bright,
I nudged the doctor to listen and see,
Now Copilot's presence reports clean and free,
Tests thump their feet — everything's alright!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding Copilot CLI plugin detection to the doctor command, which aligns with the primary objective.
Description check ✅ Passed The description covers all required template sections: Summary, Changes with file-by-file modifications, Testing instructions, and a completed PR Checklist. All key changes are documented.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/add-copilot-cli-plugin-detection-to-doctor-command

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.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.51%. Comparing base (10a79b3) to head (fb42d6d).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #40      +/-   ##
==========================================
- Coverage   99.53%   99.51%   -0.02%     
==========================================
  Files          50       50              
  Lines        5365     5379      +14     
==========================================
+ Hits         5340     5353      +13     
- Misses         25       26       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Mar 24, 2026

Greptile Summary

This PR adds a second Copilot CLI detection path to the doctor command: alongside existing hook-config-file scanning, getSystemInfo now runs copilot plugin list in parallel and checks whether copilot-safety-net appears in the output. When the plugin is found, detectAllHooks reports the Copilot CLI hook as configured with method: 'plugin list', even if no hook config files are present. The disableAllHooks setting continues to take precedence.

  • system-info.ts: hasCopilotSafetyNetPlugin() uses a word-boundary regex to avoid false positives on prefixed plugin names (e.g., other-copilot-safety-net); copilot plugin list is fetched in the existing parallel Promise.all block.
  • hooks.ts: detectCopilot() now enters the configured branch when copilotPluginInstalled === true, using the sentinel COPILOT_PLUGIN_CONFIG_PATH for configPath when no hook config files exist, and the real file paths when they co-exist.
  • Tests cover plugin-only, plugin + hook config, and disableAllHooks override scenarios.
  • tests/helpers.ts: mockVersionFetcher intercepts copilot plugin list but currently matches any copilot plugin * subcommand — a minor forward-compatibility nit.

Confidence Score: 5/5

  • This PR is safe to merge — the changes are additive, well-tested, and follow existing codebase patterns.
  • The implementation is clean and focused: a new parallel fetch, a guarded regex helper, and a small branch addition in detectCopilot(). All three new code paths (plugin-only, plugin + hook config, disableAllHooks override) are covered by dedicated tests. The only non-blocking nit is the loose args[1] === 'plugin' check in mockVersionFetcher, which has no runtime impact today.
  • No files require special attention.

Important Files Changed

Filename Overview
src/bin/doctor/system-info.ts Adds copilot plugin list to the parallel fetch array and hasCopilotSafetyNetPlugin() to parse output. Implementation is clean and follows existing patterns. Regex handles the important boundary cases (prefix hyphens, suffix hyphens) correctly for real-world plugin ID conventions.
src/bin/doctor/hooks.ts Updated detectCopilot() to report configured when plugin is detected via copilot plugin list. The previous thread concern about configPath/configPaths invariant is already flagged. Logic is correct: disableAllHooks still takes precedence, and when both plugin and hook config exist, hook config file paths are surfaced alongside the plugin list method.
src/bin/doctor/types.ts Straightforward interface extension — adds copilotPluginInstalled: boolean to SystemInfo and copilotPluginInstalled?: boolean to HookDetectOptions. Clean, well-documented.
src/bin/doctor/index.ts Minimal, correct change: passes copilotPluginInstalled from system info into detectAllHooks options alongside the existing copilotCliVersion.
tests/helpers.ts The mockVersionFetcher now returns a plugin list response for any copilot plugin * args. It only checks args[1] === 'plugin' without verifying args[2] === 'list', so any future copilot plugin <subcommand> call would receive the same mock plugin list output — a minor forward-compatibility concern.
tests/bin/doctor/hooks.test.ts Three well-structured new test cases covering: plugin-only detection, plugin + hook config coexistence, and disableAllHooks override precedence. Good coverage of the new branching logic.
tests/bin/doctor/system-info.test.ts New copilotPluginInstalled describe block adds four targeted tests: true on match, false on no match, false on partial prefix match, and false when unavailable. Complete and correct coverage.
tests/bin/doctor/format.test.ts Mechanical update to add copilotPluginInstalled: false to existing SystemInfo fixtures to satisfy the updated interface. No logic changes.

Sequence Diagram

sequenceDiagram
    participant D as runDoctor (index.ts)
    participant SI as getSystemInfo (system-info.ts)
    participant CF as copilot binary
    participant AH as detectAllHooks (hooks.ts)

    D->>SI: getSystemInfo()
    par Parallel fetches
        SI->>CF: copilot --binary-version
        SI->>CF: copilot --version
        SI->>CF: copilot plugin list
    end
    CF-->>SI: pluginListRaw (or null)
    SI->>SI: hasCopilotSafetyNetPlugin(pluginListRaw)
    SI-->>D: SystemInfo { copilotPluginInstalled: boolean, copilotCliVersion, ... }

    D->>AH: detectAllHooks(cwd, { copilotCliVersion, copilotPluginInstalled })
    AH->>AH: _checkCopilotEnabled() → check hook config files
    alt disableAllHooks found
        AH-->>D: { status: 'disabled', method: 'hook config', configPath }
    else plugin installed OR hook configs found
        Note over AH: viaPlugin = copilotPluginInstalled === true
        AH->>AH: runSelfTest()
        AH-->>D: { status: 'configured', method: 'plugin list' | 'hook config', configPath, configPaths }
    else neither
        AH-->>D: { status: 'n/a' }
    end
Loading

Reviews (3): Last reviewed commit: "fix(doctor): set configPath to 'copilot-..." | Re-trigger Greptile

Comment thread src/bin/doctor/hooks.ts
Copy link
Copy Markdown

@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.

Actionable comments posted: 3

🧹 Nitpick comments (2)
tests/bin/doctor/system-info.test.ts (1)

160-165: Add explicit return type annotations to new test fetchers.

Lines 160, 173, 186, and 199 introduce async functions without explicit return types. Please annotate them to satisfy the repo’s TypeScript typing rule.

✍️ Example pattern
-    const fetcher = async (args: string[]) => {
+    const fetcher: (args: string[]) => Promise<string | null> = async (args: string[]) => {
       if (args[0] === 'copilot' && args[1] === 'plugin') {
         return 'Installed plugins:\n  • copilot-safety-net (v1.0.0)';
       }
       return null;
     };

As per coding guidelines: All functions require type annotations in TypeScript.

Also applies to: 173-178, 186-191, 199-199

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/bin/doctor/system-info.test.ts` around lines 160 - 165, The new async
test helper functions (e.g., the const fetcher declared in this diff) lack
explicit TypeScript return annotations; update each async fetcher introduced at
the referenced locations to include an explicit return type of Promise<string |
null> so the compiler rule is satisfied (i.e., change the implicit-typed async
arrow functions to have an explicit Promise<string | null> return annotation for
each fetcher).
src/bin/doctor/system-info.ts (1)

97-103: Static analysis ReDoS warning is a false positive.

The static analyzer flagged the RegExp constructor as a potential ReDoS risk. However, COPILOT_PLUGIN_ID is a compile-time constant (not user input), and the resulting pattern (^|[^a-z0-9-])copilot-safety-net([^a-z0-9-]|$) contains no dangerous quantifiers or nested alternations—it's linear and safe.

Minor consideration: You could make the regex a module-level constant (computed once) instead of creating it on each call, though the performance difference is negligible for this use case.

♻️ Optional: Move regex to module-level constant
 const COPILOT_PLUGIN_ID = 'copilot-safety-net';
+const COPILOT_PLUGIN_PATTERN = new RegExp(
+  `(^|[^a-z0-9-])${COPILOT_PLUGIN_ID}([^a-z0-9-]|$)`,
+  'm',
+);

 function hasCopilotSafetyNetPlugin(output: string | null): boolean {
   if (!output) return false;
-
-  const pluginPattern = new RegExp(`(^|[^a-z0-9-])${COPILOT_PLUGIN_ID}([^a-z0-9-]|$)`, 'm');
-
-  return pluginPattern.test(output);
+  return COPILOT_PLUGIN_PATTERN.test(output);
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/bin/doctor/system-info.ts` around lines 97 - 103, The RegExp construction
in hasCopilotSafetyNetPlugin is flagged as ReDoS but COPILOT_PLUGIN_ID is a
compile-time constant and the pattern is safe; update the code to avoid
rebuilding the regex on every call by hoisting the pattern to a module-level
constant (e.g. define a PLUGIN_PATTERN or COPILOT_PLUGIN_REGEX using
COPILOT_PLUGIN_ID) and then have hasCopilotSafetyNetPlugin(output) simply test
against that constant; keep the same pattern semantics
((^|[^a-z0-9-])...([^a-z0-9-]|$)) and return pluginRegex.test(output) as before.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@AGENTS.md`:
- Line 21: Update the AGENTS.md description for the "bun run check" command to
include the missing "ast-grep scan" step; locate the sentence that currently
lists the pipeline ("biome check → typecheck → knip → bun test") and change it
to explicitly enumerate "biome check → typecheck → knip → ast-grep scan → bun
test" so contributors know the full validation pipeline when running `bun run
check`.

In `@CLAUDE.md`:
- Line 22: Update the CLAUDE.md sentence that describes what `bun run check`
runs so it includes the missing `ast-grep scan`; specifically edit the line
containing "Always use `bun run check` to verify changes." (the paragraph
listing checks for `bun run check`) to reflect the full sequence: biome check →
typecheck → knip → ast-grep scan → bun test, ensuring the documented order
matches the actual script.

In `@tests/helpers.ts`:
- Around line 72-75: The mock that handles multi-word commands in
tests/helpers.ts is too permissive (it matches any "copilot plugin ..."); update
the condition in that block (the args array check) to match exactly the "copilot
plugin list" invocation (e.g., check args[0] === 'copilot' && args[1] ===
'plugin' && args[2] === 'list' or compare args.join(' ') === 'copilot plugin
list') so only the precise command returns the mocked "Installed plugins"
string.

---

Nitpick comments:
In `@src/bin/doctor/system-info.ts`:
- Around line 97-103: The RegExp construction in hasCopilotSafetyNetPlugin is
flagged as ReDoS but COPILOT_PLUGIN_ID is a compile-time constant and the
pattern is safe; update the code to avoid rebuilding the regex on every call by
hoisting the pattern to a module-level constant (e.g. define a PLUGIN_PATTERN or
COPILOT_PLUGIN_REGEX using COPILOT_PLUGIN_ID) and then have
hasCopilotSafetyNetPlugin(output) simply test against that constant; keep the
same pattern semantics ((^|[^a-z0-9-])...([^a-z0-9-]|$)) and return
pluginRegex.test(output) as before.

In `@tests/bin/doctor/system-info.test.ts`:
- Around line 160-165: The new async test helper functions (e.g., the const
fetcher declared in this diff) lack explicit TypeScript return annotations;
update each async fetcher introduced at the referenced locations to include an
explicit return type of Promise<string | null> so the compiler rule is satisfied
(i.e., change the implicit-typed async arrow functions to have an explicit
Promise<string | null> return annotation for each fetcher).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 14aca37e-3d39-434b-b394-341164de212b

📥 Commits

Reviewing files that changed from the base of the PR and between 038ca28 and a20c094.

⛔ Files ignored due to path filters (3)
  • dist/bin/cc-safety-net.js is excluded by !**/dist/**
  • dist/bin/doctor/hooks.d.ts is excluded by !**/dist/**
  • dist/bin/doctor/types.d.ts is excluded by !**/dist/**
📒 Files selected for processing (10)
  • AGENTS.md
  • CLAUDE.md
  • src/bin/doctor/hooks.ts
  • src/bin/doctor/index.ts
  • src/bin/doctor/system-info.ts
  • src/bin/doctor/types.ts
  • tests/bin/doctor/format.test.ts
  • tests/bin/doctor/hooks.test.ts
  • tests/bin/doctor/system-info.test.ts
  • tests/helpers.ts

Comment thread AGENTS.md
| Doctor | `bun src/bin/cc-safety-net.ts doctor` |

**`bun run check`** runs: biome check → typecheck → knip → ast-grep scan → bun test
**Always use `bun run check` to verify changes.** This runs typecheck, knip, biome lint, and tests together. Do not run these separately.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Include AST scan in the bun run check description.

Line 21 explicitly lists what runs, but it omits ast-grep scan, which can mislead contributors about the full validation pipeline.

📝 Suggested doc tweak
-**Always use `bun run check` to verify changes.** This runs typecheck, knip, biome lint, and tests together. Do not run these separately.
+**Always use `bun run check` to verify changes.** This runs biome check, typecheck, knip, ast-grep scan, and tests together. Do not run these separately.

Based on learnings: Run bun run check before committing which executes: biome check → typecheck → knip → ast-grep scan → bun test.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
**Always use `bun run check` to verify changes.** This runs typecheck, knip, biome lint, and tests together. Do not run these separately.
**Always use `bun run check` to verify changes.** This runs biome check, typecheck, knip, ast-grep scan, and tests together. Do not run these separately.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@AGENTS.md` at line 21, Update the AGENTS.md description for the "bun run
check" command to include the missing "ast-grep scan" step; locate the sentence
that currently lists the pipeline ("biome check → typecheck → knip → bun test")
and change it to explicitly enumerate "biome check → typecheck → knip → ast-grep
scan → bun test" so contributors know the full validation pipeline when running
`bun run check`.

Comment thread CLAUDE.md
- **Build**: `bun run build`
- **Doctor**: `bun src/bin/cc-safety-net.ts doctor` (diagnostics)

**Always use `bun run check` to verify changes.** This runs typecheck, knip, biome lint, and tests together. Do not run these separately.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Keep bun run check contents accurate here as well.

Line 22 omits ast-grep scan from the listed checks, so the instruction is incomplete.

📝 Suggested doc tweak
-**Always use `bun run check` to verify changes.** This runs typecheck, knip, biome lint, and tests together. Do not run these separately.
+**Always use `bun run check` to verify changes.** This runs biome check, typecheck, knip, ast-grep scan, and tests together. Do not run these separately.

Based on learnings: Run bun run check before committing which executes: biome check → typecheck → knip → ast-grep scan → bun test.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
**Always use `bun run check` to verify changes.** This runs typecheck, knip, biome lint, and tests together. Do not run these separately.
**Always use `bun run check` to verify changes.** This runs biome check, typecheck, knip, ast-grep scan, and tests together. Do not run these separately.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@CLAUDE.md` at line 22, Update the CLAUDE.md sentence that describes what `bun
run check` runs so it includes the missing `ast-grep scan`; specifically edit
the line containing "Always use `bun run check` to verify changes." (the
paragraph listing checks for `bun run check`) to reflect the full sequence:
biome check → typecheck → knip → ast-grep scan → bun test, ensuring the
documented order matches the actual script.

Comment thread tests/helpers.ts
Comment on lines +72 to +75
// Handle multi-word commands like `copilot plugin list`
if (args[0] === 'copilot' && args[1] === 'plugin') {
return 'Installed plugins:\n • copilot-safety-net (v1.0.0)';
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Tighten the mock to copilot plugin list specifically.

Lines 73-74 currently match any copilot plugin ... command. That can let incorrect command shapes pass tests unintentionally.

✅ Suggested fix
-  if (args[0] === 'copilot' && args[1] === 'plugin') {
+  if (args[0] === 'copilot' && args[1] === 'plugin' && args[2] === 'list') {
     return 'Installed plugins:\n  • copilot-safety-net (v1.0.0)';
   }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/helpers.ts` around lines 72 - 75, The mock that handles multi-word
commands in tests/helpers.ts is too permissive (it matches any "copilot plugin
..."); update the condition in that block (the args array check) to match
exactly the "copilot plugin list" invocation (e.g., check args[0] === 'copilot'
&& args[1] === 'plugin' && args[2] === 'list' or compare args.join(' ') ===
'copilot plugin list') so only the precise command returns the mocked "Installed
plugins" string.

Repository owner deleted a comment from chatgpt-codex-connector Bot Mar 24, 2026
Copy link
Copy Markdown

@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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/bin/doctor/hooks.ts`:
- Around line 688-697: The branch that returns the Copilot config object uses
primaryConfigPath from hooksCheck.activeConfigPaths and therefore yields
undefined when copilotPluginInstalled is true but no hook files exist; update
the return in that if-block (the code referencing
options.copilotPluginInstalled, viaPlugin, primaryConfigPath, and
hooksCheck.activeConfigPaths) to set configPath to a plugin-source fallback when
viaPlugin is true and hooksCheck.activeConfigPaths is empty (for example derive
a value from options (e.g. options.copilotPluginSource) or use a sentinel like
'copilot-plugin' as the configPath), and ensure configPaths remains undefined or
empty as appropriate.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7e4c354b-3887-40cd-b3d8-f62a7eba8596

📥 Commits

Reviewing files that changed from the base of the PR and between a20c094 and 5285a37.

⛔ Files ignored due to path filters (1)
  • dist/bin/cc-safety-net.js is excluded by !**/dist/**
📒 Files selected for processing (2)
  • src/bin/doctor/hooks.ts
  • tests/bin/doctor/hooks.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/bin/doctor/hooks.test.ts

Comment thread src/bin/doctor/hooks.ts
@kenryu42
Copy link
Copy Markdown
Owner Author

@greptileai pls review

@kenryu42
Copy link
Copy Markdown
Owner Author

@coderabbitai pls review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 24, 2026

@kenryu42 Sure! I'll start reviewing the PR right away.

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@kenryu42
Copy link
Copy Markdown
Owner Author

@greptileai pls review

@kenryu42 kenryu42 merged commit 864445a into main Mar 24, 2026
9 checks passed
@kenryu42 kenryu42 deleted the feat/add-copilot-cli-plugin-detection-to-doctor-command branch March 24, 2026 15:09
@coderabbitai coderabbitai Bot mentioned this pull request May 6, 2026
7 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.

1 participant