Skip to content

fix(setup): remove duplicate dev paths in plugin-setup#1943

Merged
Yeachan-Heo merged 1 commit intoYeachan-Heo:devfrom
riftzen-bit:fix/pr1896-split-plugin-paths
Mar 28, 2026
Merged

fix(setup): remove duplicate dev paths in plugin-setup#1943
Yeachan-Heo merged 1 commit intoYeachan-Heo:devfrom
riftzen-bit:fix/pr1896-split-plugin-paths

Conversation

@riftzen-bit
Copy link
Copy Markdown
Contributor

Bug

The devPaths array in the generated HUD wrapper script (omc-hud.mjs) inside scripts/plugin-setup.mjs had 4 entries where entries 3-4 were exact duplicates of entries 1-2:

const devPaths = [
  join(home, "Workspace/oh-my-claudecode/dist/hud/index.js"),
  join(home, "workspace/oh-my-claudecode/dist/hud/index.js"),
  join(home, "Workspace/oh-my-claudecode/dist/hud/index.js"),  // duplicate
  join(home, "workspace/oh-my-claudecode/dist/hud/index.js"),  // duplicate
];

Fix

Removed the 2 duplicate lines. The array now contains only the 2 unique entries (capital Workspace and lowercase workspace variants).

Test

Added src/__tests__/plugin-setup-devpaths.test.ts with regression tests that:

  • Verify the devPaths array has no duplicate entries
  • Verify both Workspace and workspace variants are still present

CI

  • npx tsc --noEmit — 0 errors
  • npx vitest run — 7084 passed, 7 skipped
  • npm run build — success

The devPaths array in the generated HUD wrapper script had 4 entries
where entries 3-4 were exact duplicates of entries 1-2 (Workspace and
workspace variants). Removed the 2 duplicate lines.

Confidence: high
Scope-risk: narrow
Copilot AI review requested due to automatic review settings March 28, 2026 20:16
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

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

Removes duplicate devPaths entries from the HUD wrapper script template embedded in scripts/plugin-setup.mjs, and adds a regression test to prevent reintroducing duplicates.

Changes:

  • Removed two duplicate devPaths entries in the generated omc-hud.mjs wrapper script template.
  • Added a Vitest regression test to assert devPaths is deduplicated and retains both Workspace/workspace variants.

Reviewed changes

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

File Description
scripts/plugin-setup.mjs Removes duplicate development path entries in the embedded HUD wrapper script template.
src/tests/plugin-setup-devpaths.test.ts Adds regression coverage to detect duplicate devPaths entries and ensure both case variants remain present.

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

Comment on lines +18 to +25
describe('plugin-setup.mjs devPaths deduplication', () => {
const scriptContent = existsSync(PLUGIN_SETUP_PATH)
? readFileSync(PLUGIN_SETUP_PATH, 'utf-8')
: '';

it('script file exists', () => {
expect(existsSync(PLUGIN_SETUP_PATH)).toBe(true);
});
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

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

scriptContent is computed at describe-time with a '' fallback when the file is missing. If scripts/plugin-setup.mjs is absent, the later tests will still run against the empty string and fail with less-informative match/assertion errors in addition to the existence check. Consider reading the file in a beforeAll (or inside each test) after asserting the file exists, and fail fast if it doesn't.

Copilot uses AI. Check for mistakes.
Comment on lines +39 to +41
.filter(line => line.startsWith('join('));

// Verify no duplicates
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

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

The duplicate check compares raw trimmed source lines (new Set(pathEntries)), so duplicates with different formatting (e.g., whitespace differences, trailing comments, or a missing comma) would not be detected even though the resulting devPaths entries are duplicates. To make this regression test robust, extract/normalize the actual path string argument(s) from each join(...) entry before de-duplicating.

Suggested change
.filter(line => line.startsWith('join('));
// Verify no duplicates
.filter(line => line.startsWith('join('))
.map(line => {
// Normalize by extracting all string literal arguments to join(...)
const argsMatch = line.match(/join\((.*)\)/);
if (!argsMatch) {
return line;
}
const argContent = argsMatch[1];
const stringLiterals = Array.from(
argContent.matchAll(/(['"`])([^'"`]*?)\1/g)
).map(match => match[2]);
// Use concatenated string literals as a stable key; fall back to a
// whitespace-normalized argument list if no literals are present.
if (stringLiterals.length > 0) {
return stringLiterals.join('|');
}
return argContent.replace(/\s+/g, '');
});
// Verify no duplicates in normalized entries

Copilot uses AI. Check for mistakes.
@Yeachan-Heo Yeachan-Heo merged commit 3df13af into Yeachan-Heo:dev Mar 28, 2026
10 of 11 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