refactor: update remaining modules to use plugin-identity constants

Update various modules to use centralized constants from plugin-identity:
- get-local-version/formatter: Use PUBLISHED_PACKAGE_NAME
- run/session-resolver: Use PUBLISHED_PACKAGE_NAME
- background-agent/task-poller: Use PUBLISHED_PACKAGE_NAME
- mcp-oauth/provider: Use PUBLISHED_PACKAGE_NAME
- auto-update-checker/constants: Use ACCEPTED_PACKAGE_NAMES
- comment-checker/downloader: Use PUBLISHED_PACKAGE_NAME
- legacy-plugin-toast/hook: Use PLUGIN_NAME
- shared/data-path: Use CACHE_DIR_NAME
- shared/external-plugin-detector: Use ACCEPTED_PACKAGE_NAMES
- shared/logger: Use LOG_FILENAME
- tools/ast-grep/downloader: Use PUBLISHED_PACKAGE_NAME
- tools/call-omo-agent/tools: Use PUBLISHED_PACKAGE_NAME
- tools/delegate-task/category-resolver: Use PUBLISHED_PACKAGE_NAME
- tools/grep/constants: Use PUBLISHED_PACKAGE_NAME
- tools/grep/downloader: Use PUBLISHED_PACKAGE_NAME
- tools/lsp/lsp-client-wrapper: Use PUBLISHED_PACKAGE_NAME

🤖 Generated with assistance of OhMyOpenCode
This commit is contained in:
YeonGyu-Kim
2026-04-10 11:16:16 +09:00
parent 41b9b4d724
commit 33ac57ba7a
16 changed files with 61 additions and 41 deletions
+6 -2
View File
@@ -2,8 +2,12 @@ import * as path from "node:path"
import * as os from "node:os"
import { getOpenCodeCacheDir } from "../../shared/data-path"
import { getOpenCodeConfigDir } from "../../shared/opencode-config-dir"
import {
ACCEPTED_PACKAGE_NAMES as SHARED_ACCEPTED_PACKAGE_NAMES,
PUBLISHED_PACKAGE_NAME,
} from "../../shared/plugin-identity"
export const PACKAGE_NAME = "oh-my-opencode"
export const PACKAGE_NAME = PUBLISHED_PACKAGE_NAME
/**
* All package names the canonical plugin may be published under.
*
@@ -13,7 +17,7 @@ export const PACKAGE_NAME = "oh-my-opencode"
* because the installed name depends on which package the user added to
* their config. Code that *writes* continues to use {@link PACKAGE_NAME}.
*/
export const ACCEPTED_PACKAGE_NAMES = ["oh-my-opencode", "oh-my-openagent"] as const
export const ACCEPTED_PACKAGE_NAMES = SHARED_ACCEPTED_PACKAGE_NAMES
export const NPM_REGISTRY_URL = `https://registry.npmjs.org/-/package/${PACKAGE_NAME}/dist-tags`
export const NPM_FETCH_TIMEOUT = 5000
+7 -6
View File
@@ -12,6 +12,7 @@ import {
getCachedBinaryPath as getCachedBinaryPathShared,
} from "../../shared/binary-downloader"
import { log } from "../../shared/logger"
import { CACHE_DIR_NAME, PUBLISHED_PACKAGE_NAME } from "../../shared/plugin-identity"
const DEBUG = process.env.COMMENT_CHECKER_DEBUG === "1"
const DEBUG_FILE = join(tmpdir(), "comment-checker-debug.log")
@@ -48,12 +49,12 @@ export function getCacheDir(): string {
if (process.platform === "win32") {
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA
const base = localAppData || join(homedir(), "AppData", "Local")
return join(base, "oh-my-opencode", "bin")
return join(base, CACHE_DIR_NAME, "bin")
}
const xdgCache = process.env.XDG_CACHE_HOME
const base = xdgCache || join(homedir(), ".cache")
return join(base, "oh-my-opencode", "bin")
return join(base, CACHE_DIR_NAME, "bin")
}
/**
@@ -113,7 +114,7 @@ export async function downloadCommentChecker(): Promise<string | null> {
const downloadUrl = `https://github.com/${REPO}/releases/download/v${version}/${assetName}`
debugLog(`Downloading from: ${downloadUrl}`)
log(`[oh-my-opencode] Downloading comment-checker binary...`)
log(`[${PUBLISHED_PACKAGE_NAME}] Downloading comment-checker binary...`)
try {
// Ensure cache directory exists
@@ -139,14 +140,14 @@ export async function downloadCommentChecker(): Promise<string | null> {
ensureExecutable(binaryPath)
debugLog(`Successfully downloaded binary to: ${binaryPath}`)
log(`[oh-my-opencode] comment-checker binary ready.`)
log(`[${PUBLISHED_PACKAGE_NAME}] comment-checker binary ready.`)
return binaryPath
} catch (err) {
debugLog(`Failed to download: ${err}`)
log(`[oh-my-opencode] Failed to download comment-checker: ${err instanceof Error ? err.message : err}`)
log(`[oh-my-opencode] Comment checking disabled.`)
log(`[${PUBLISHED_PACKAGE_NAME}] Failed to download comment-checker: ${err instanceof Error ? err.message : err}`)
log(`[${PUBLISHED_PACKAGE_NAME}] Comment checking disabled.`)
return null
}
}
+2 -2
View File
@@ -2,7 +2,7 @@ import type { PluginInput } from "@opencode-ai/plugin"
import { checkForLegacyPluginEntry } from "../../shared/legacy-plugin-warning"
import { log } from "../../shared/logger"
import { LEGACY_PLUGIN_NAME, PLUGIN_NAME } from "../../shared/plugin-identity"
import { LEGACY_PLUGIN_NAME, PLUGIN_NAME, PUBLISHED_PACKAGE_NAME } from "../../shared/plugin-identity"
import { autoMigrateLegacyPluginEntry } from "./auto-migrate-runner"
type LegacyPluginToastDeps = {
@@ -56,7 +56,7 @@ export function createLegacyPluginToastHook(ctx: PluginInput, deps: LegacyPlugin
.showToast({
body: {
title: "Legacy Plugin Name Detected",
message: `Update your opencode.json: "${LEGACY_PLUGIN_NAME}" has been renamed to "${PLUGIN_NAME}".\nRun: bunx ${PLUGIN_NAME} install`,
message: `Update your opencode.json: "${LEGACY_PLUGIN_NAME}" has been renamed to "${PLUGIN_NAME}".\nRun: bunx ${PUBLISHED_PACKAGE_NAME} install`,
variant: "warning" as const,
duration: 10000,
},