diff --git a/src/shared/bundled-notify-ownership.test.ts b/src/shared/bundled-notify-ownership.test.ts index 0881e5802..48af2fa5d 100644 --- a/src/shared/bundled-notify-ownership.test.ts +++ b/src/shared/bundled-notify-ownership.test.ts @@ -96,6 +96,32 @@ describe("ensureBundledNotifyOwnership", () => { expect(readConfig(userConfigPath).plugin).toEqual(["oh-my-openagent", canonicalEntry]) }) + test("rewrites recognized external notify with underscore dist-tag to bundled owner", () => { + // given + const userConfigPath = join(userConfigDir, "opencode.json") + writeFileSync(userConfigPath, JSON.stringify({ plugin: ["kdco/notify@release_candidate", "oh-my-openagent"] }, null, 2) + "\n") + + // when + const result = ensureBundledNotifyOwnership({ projectDirectory: projectDir, packageRoot }) + + // then + expect(result.changedUserConfig).toBe(true) + expect(readConfig(userConfigPath).plugin).toEqual(["oh-my-openagent", canonicalEntry]) + }) + + test("rewrites npm-prefixed recognized notify with underscore dist-tag to bundled owner", () => { + // given + const userConfigPath = join(userConfigDir, "opencode.json") + writeFileSync(userConfigPath, JSON.stringify({ plugin: ["npm:kdco/notify@release_candidate", "oh-my-openagent"] }, null, 2) + "\n") + + // when + const result = ensureBundledNotifyOwnership({ projectDirectory: projectDir, packageRoot }) + + // then + expect(result.changedUserConfig).toBe(true) + expect(readConfig(userConfigPath).plugin).toEqual(["oh-my-openagent", canonicalEntry]) + }) + test("rewrites recognized tuple notify in user config when tuple options are empty", () => { // given const userConfigPath = join(userConfigDir, "opencode.json") diff --git a/src/shared/bundled-notify-ownership.ts b/src/shared/bundled-notify-ownership.ts index d77456333..457685685 100644 --- a/src/shared/bundled-notify-ownership.ts +++ b/src/shared/bundled-notify-ownership.ts @@ -76,7 +76,7 @@ function isRecognizedExternalNotifyId(entry: string): boolean { if (versionSuffix.includes("/")) return false if (versionSuffix.includes("\\")) return false - return /^[a-z0-9.*+!~^<>=| -]+$/i.test(versionSuffix) + return /^[a-z0-9_.*+!~^<>=| -]+$/i.test(versionSuffix) }) }