fix(release): revert package identity to oh-my-opencode
Keep installer, config detection, schema generation, and publish workflows aligned with the long-lived oh-my-opencode package so this release does not split across two npm names. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -7,8 +7,7 @@ import { detectConfigFormat } from "./opencode-config-format"
|
||||
import { parseOpenCodeConfigFileWithError, type OpenCodeConfig } from "./parse-opencode-config-file"
|
||||
import { getPluginNameWithVersion } from "./plugin-name-with-version"
|
||||
|
||||
const OLD_PACKAGE_NAME = "oh-my-opencode"
|
||||
const NEW_PACKAGE_NAME = "oh-my-openagent"
|
||||
const PACKAGE_NAME = "oh-my-opencode"
|
||||
|
||||
export async function addPluginToOpenCodeConfig(currentVersion: string): Promise<ConfigMergeResult> {
|
||||
try {
|
||||
@@ -22,7 +21,7 @@ export async function addPluginToOpenCodeConfig(currentVersion: string): Promise
|
||||
}
|
||||
|
||||
const { format, path } = detectConfigFormat()
|
||||
const pluginEntry = await getPluginNameWithVersion(currentVersion, NEW_PACKAGE_NAME)
|
||||
const pluginEntry = await getPluginNameWithVersion(currentVersion, PACKAGE_NAME)
|
||||
|
||||
try {
|
||||
if (format === "none") {
|
||||
@@ -42,13 +41,7 @@ export async function addPluginToOpenCodeConfig(currentVersion: string): Promise
|
||||
|
||||
const config = parseResult.config
|
||||
const plugins = config.plugin ?? []
|
||||
const existingIndex = plugins.findIndex(
|
||||
(p) =>
|
||||
p === OLD_PACKAGE_NAME ||
|
||||
p.startsWith(`${OLD_PACKAGE_NAME}@`) ||
|
||||
p === NEW_PACKAGE_NAME ||
|
||||
p.startsWith(`${NEW_PACKAGE_NAME}@`)
|
||||
)
|
||||
const existingIndex = plugins.findIndex((plugin) => plugin === PACKAGE_NAME || plugin.startsWith(`${PACKAGE_NAME}@`))
|
||||
|
||||
if (existingIndex !== -1) {
|
||||
if (plugins[existingIndex] === pluginEntry) {
|
||||
|
||||
@@ -56,6 +56,7 @@ function detectProvidersFromOmoConfig(): {
|
||||
}
|
||||
|
||||
export function detectCurrentConfig(): DetectedConfig {
|
||||
const PACKAGE_NAME = "oh-my-opencode"
|
||||
const result: DetectedConfig = {
|
||||
isInstalled: false,
|
||||
hasClaude: true,
|
||||
@@ -65,7 +66,7 @@ export function detectCurrentConfig(): DetectedConfig {
|
||||
hasCopilot: false,
|
||||
hasOpencodeZen: true,
|
||||
hasZaiCodingPlan: false,
|
||||
hasKimiForCoding: false,
|
||||
hasKimiForCoding: false,
|
||||
hasOpencodeGo: false,
|
||||
}
|
||||
|
||||
@@ -81,9 +82,7 @@ hasKimiForCoding: false,
|
||||
|
||||
const openCodeConfig = parseResult.config
|
||||
const plugins = openCodeConfig.plugin ?? []
|
||||
const OLD_PACKAGE_NAME = "oh-my-opencode"
|
||||
const NEW_PACKAGE_NAME = "oh-my-openagent"
|
||||
result.isInstalled = plugins.some((p) => p.startsWith(OLD_PACKAGE_NAME) || p.startsWith(NEW_PACKAGE_NAME))
|
||||
result.isInstalled = plugins.some((plugin) => plugin.startsWith(PACKAGE_NAME))
|
||||
|
||||
if (!result.isInstalled) {
|
||||
return result
|
||||
|
||||
@@ -7,7 +7,7 @@ import { resetConfigContext } from "./config-context"
|
||||
import { detectCurrentConfig } from "./detect-current-config"
|
||||
import { addPluginToOpenCodeConfig } from "./add-plugin-to-opencode-config"
|
||||
|
||||
describe("detectCurrentConfig - dual name detection", () => {
|
||||
describe("detectCurrentConfig - single package detection", () => {
|
||||
let testConfigDir = ""
|
||||
let testConfigPath = ""
|
||||
let testOmoConfigPath = ""
|
||||
@@ -40,18 +40,6 @@ describe("detectCurrentConfig - dual name detection", () => {
|
||||
expect(result.isInstalled).toBe(true)
|
||||
})
|
||||
|
||||
it("detects oh-my-openagent in plugin array", () => {
|
||||
// given
|
||||
const config = { plugin: ["oh-my-openagent"] }
|
||||
writeFileSync(testConfigPath, JSON.stringify(config, null, 2) + "\n", "utf-8")
|
||||
|
||||
// when
|
||||
const result = detectCurrentConfig()
|
||||
|
||||
// then
|
||||
expect(result.isInstalled).toBe(true)
|
||||
})
|
||||
|
||||
it("detects oh-my-opencode with version pin", () => {
|
||||
// given
|
||||
const config = { plugin: ["oh-my-opencode@3.11.0"] }
|
||||
@@ -64,18 +52,6 @@ describe("detectCurrentConfig - dual name detection", () => {
|
||||
expect(result.isInstalled).toBe(true)
|
||||
})
|
||||
|
||||
it("detects oh-my-openagent with version pin", () => {
|
||||
// given
|
||||
const config = { plugin: ["oh-my-openagent@3.12.0"] }
|
||||
writeFileSync(testConfigPath, JSON.stringify(config, null, 2) + "\n", "utf-8")
|
||||
|
||||
// when
|
||||
const result = detectCurrentConfig()
|
||||
|
||||
// then
|
||||
expect(result.isInstalled).toBe(true)
|
||||
})
|
||||
|
||||
it("returns false when plugin not present", () => {
|
||||
// given
|
||||
const config = { plugin: ["some-other-plugin"] }
|
||||
@@ -90,7 +66,7 @@ describe("detectCurrentConfig - dual name detection", () => {
|
||||
|
||||
it("detects OpenCode Go from the existing omo config", () => {
|
||||
// given
|
||||
writeFileSync(testConfigPath, JSON.stringify({ plugin: ["oh-my-openagent"] }, null, 2) + "\n", "utf-8")
|
||||
writeFileSync(testConfigPath, JSON.stringify({ plugin: ["oh-my-opencode"] }, null, 2) + "\n", "utf-8")
|
||||
writeFileSync(
|
||||
testOmoConfigPath,
|
||||
JSON.stringify({ agents: { atlas: { model: "opencode-go/kimi-k2.5" } } }, null, 2) + "\n",
|
||||
@@ -106,7 +82,7 @@ describe("detectCurrentConfig - dual name detection", () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe("addPluginToOpenCodeConfig - dual name detection", () => {
|
||||
describe("addPluginToOpenCodeConfig - single package writes", () => {
|
||||
let testConfigDir = ""
|
||||
let testConfigPath = ""
|
||||
|
||||
@@ -125,7 +101,7 @@ describe("addPluginToOpenCodeConfig - dual name detection", () => {
|
||||
delete process.env.OPENCODE_CONFIG_DIR
|
||||
})
|
||||
|
||||
it("finds and replaces old oh-my-opencode with new name", async () => {
|
||||
it("keeps oh-my-opencode when it already exists", async () => {
|
||||
// given
|
||||
const config = { plugin: ["oh-my-opencode"] }
|
||||
writeFileSync(testConfigPath, JSON.stringify(config, null, 2) + "\n", "utf-8")
|
||||
@@ -136,26 +112,10 @@ describe("addPluginToOpenCodeConfig - dual name detection", () => {
|
||||
// then
|
||||
expect(result.success).toBe(true)
|
||||
const savedConfig = JSON.parse(readFileSync(testConfigPath, "utf-8"))
|
||||
expect(savedConfig.plugin).toContain("oh-my-openagent")
|
||||
expect(savedConfig.plugin).not.toContain("oh-my-opencode")
|
||||
expect(savedConfig.plugin).toContain("oh-my-opencode")
|
||||
})
|
||||
|
||||
it("finds and replaces oh-my-openagent with new name", async () => {
|
||||
// given
|
||||
const config = { plugin: ["oh-my-openagent"] }
|
||||
writeFileSync(testConfigPath, JSON.stringify(config, null, 2) + "\n", "utf-8")
|
||||
|
||||
// when
|
||||
const result = await addPluginToOpenCodeConfig("3.11.0")
|
||||
|
||||
// then
|
||||
expect(result.success).toBe(true)
|
||||
const savedConfig = JSON.parse(readFileSync(testConfigPath, "utf-8"))
|
||||
expect(savedConfig.plugin).toContain("oh-my-openagent")
|
||||
expect(savedConfig.plugin).not.toContain("oh-my-opencode")
|
||||
})
|
||||
|
||||
it("finds and replaces version-pinned oh-my-opencode@X.Y.Z", async () => {
|
||||
it("replaces version-pinned oh-my-opencode@X.Y.Z", async () => {
|
||||
// given
|
||||
const config = { plugin: ["oh-my-opencode@3.10.0"] }
|
||||
writeFileSync(testConfigPath, JSON.stringify(config, null, 2) + "\n", "utf-8")
|
||||
@@ -166,27 +126,12 @@ describe("addPluginToOpenCodeConfig - dual name detection", () => {
|
||||
// then
|
||||
expect(result.success).toBe(true)
|
||||
const savedConfig = JSON.parse(readFileSync(testConfigPath, "utf-8"))
|
||||
expect(savedConfig.plugin).toContain("oh-my-openagent")
|
||||
expect(savedConfig.plugin).toContain("oh-my-opencode")
|
||||
expect(savedConfig.plugin).not.toContain("oh-my-opencode@3.10.0")
|
||||
})
|
||||
|
||||
it("finds and replaces version-pinned oh-my-openagent@X.Y.Z", async () => {
|
||||
// given
|
||||
const config = { plugin: ["oh-my-openagent@3.10.0"] }
|
||||
writeFileSync(testConfigPath, JSON.stringify(config, null, 2) + "\n", "utf-8")
|
||||
|
||||
// when
|
||||
const result = await addPluginToOpenCodeConfig("3.11.0")
|
||||
|
||||
// then
|
||||
expect(result.success).toBe(true)
|
||||
const savedConfig = JSON.parse(readFileSync(testConfigPath, "utf-8"))
|
||||
expect(savedConfig.plugin).toContain("oh-my-openagent")
|
||||
expect(savedConfig.plugin).not.toContain("oh-my-openagent@3.10.0")
|
||||
})
|
||||
|
||||
it("adds new plugin when none exists", async () => {
|
||||
// given - no plugin array
|
||||
// given
|
||||
const config = {}
|
||||
writeFileSync(testConfigPath, JSON.stringify(config, null, 2) + "\n", "utf-8")
|
||||
|
||||
@@ -196,11 +141,11 @@ describe("addPluginToOpenCodeConfig - dual name detection", () => {
|
||||
// then
|
||||
expect(result.success).toBe(true)
|
||||
const savedConfig = JSON.parse(readFileSync(testConfigPath, "utf-8"))
|
||||
expect(savedConfig.plugin).toContain("oh-my-openagent")
|
||||
expect(savedConfig.plugin).toContain("oh-my-opencode")
|
||||
})
|
||||
|
||||
it("adds plugin when plugin array is empty", async () => {
|
||||
// given - empty plugin array
|
||||
// given
|
||||
const config = { plugin: [] }
|
||||
writeFileSync(testConfigPath, JSON.stringify(config, null, 2) + "\n", "utf-8")
|
||||
|
||||
@@ -210,6 +155,6 @@ describe("addPluginToOpenCodeConfig - dual name detection", () => {
|
||||
// then
|
||||
expect(result.success).toBe(true)
|
||||
const savedConfig = JSON.parse(readFileSync(testConfigPath, "utf-8"))
|
||||
expect(savedConfig.plugin).toContain("oh-my-openagent")
|
||||
expect(savedConfig.plugin).toContain("oh-my-opencode")
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { fetchNpmDistTags } from "./npm-dist-tags"
|
||||
|
||||
const DEFAULT_PACKAGE_NAME = "oh-my-opencode"
|
||||
const NEW_PACKAGE_NAME = "oh-my-openagent"
|
||||
const PRIORITIZED_TAGS = ["latest", "beta", "next"] as const
|
||||
|
||||
function getFallbackEntry(version: string, packageName: string): string {
|
||||
@@ -17,7 +16,7 @@ export async function getPluginNameWithVersion(
|
||||
currentVersion: string,
|
||||
packageName: string = DEFAULT_PACKAGE_NAME
|
||||
): Promise<string> {
|
||||
const distTags = await fetchNpmDistTags(NEW_PACKAGE_NAME)
|
||||
const distTags = await fetchNpmDistTags(packageName)
|
||||
|
||||
|
||||
if (distTags) {
|
||||
|
||||
Reference in New Issue
Block a user