feat(comment-checker): add Windows support
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "oh-my-opencode",
|
"name": "oh-my-opencode",
|
||||||
"version": "0.1.12",
|
"version": "0.1.13",
|
||||||
"description": "OpenCode plugin - custom agents (oracle, librarian) and enhanced features",
|
"description": "OpenCode plugin - custom agents (oracle, librarian) and enhanced features",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
|
|||||||
@@ -25,18 +25,26 @@ function getPlatformPackageName(): string | null {
|
|||||||
"darwin-x64": "@code-yeongyu/comment-checker-darwin-x64",
|
"darwin-x64": "@code-yeongyu/comment-checker-darwin-x64",
|
||||||
"linux-arm64": "@code-yeongyu/comment-checker-linux-arm64",
|
"linux-arm64": "@code-yeongyu/comment-checker-linux-arm64",
|
||||||
"linux-x64": "@code-yeongyu/comment-checker-linux-x64",
|
"linux-x64": "@code-yeongyu/comment-checker-linux-x64",
|
||||||
|
"win32-x64": "@code-yeongyu/comment-checker-windows-x64",
|
||||||
|
"win32-arm64": "@code-yeongyu/comment-checker-windows-arm64",
|
||||||
}
|
}
|
||||||
|
|
||||||
return platformMap[`${platform}-${arch}`] ?? null
|
return platformMap[`${platform}-${arch}`] ?? null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getBinaryName(): string {
|
||||||
|
return process.platform === "win32" ? "comment-checker.exe" : "comment-checker"
|
||||||
|
}
|
||||||
|
|
||||||
function findCommentCheckerPath(): string | null {
|
function findCommentCheckerPath(): string | null {
|
||||||
|
const binaryName = getBinaryName()
|
||||||
|
|
||||||
// 1. Try to find from @code-yeongyu/comment-checker package
|
// 1. Try to find from @code-yeongyu/comment-checker package
|
||||||
try {
|
try {
|
||||||
const require = createRequire(import.meta.url)
|
const require = createRequire(import.meta.url)
|
||||||
const cliPkgPath = require.resolve("@code-yeongyu/comment-checker/package.json")
|
const cliPkgPath = require.resolve("@code-yeongyu/comment-checker/package.json")
|
||||||
const cliDir = dirname(cliPkgPath)
|
const cliDir = dirname(cliPkgPath)
|
||||||
const binaryPath = join(cliDir, "bin", "comment-checker")
|
const binaryPath = join(cliDir, "bin", binaryName)
|
||||||
|
|
||||||
if (existsSync(binaryPath)) {
|
if (existsSync(binaryPath)) {
|
||||||
debugLog("found binary in main package:", binaryPath)
|
debugLog("found binary in main package:", binaryPath)
|
||||||
@@ -46,14 +54,14 @@ function findCommentCheckerPath(): string | null {
|
|||||||
debugLog("main package not installed")
|
debugLog("main package not installed")
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Try platform-specific package directly
|
// 2. Try platform-specific package directly (legacy, for backwards compatibility)
|
||||||
const platformPkg = getPlatformPackageName()
|
const platformPkg = getPlatformPackageName()
|
||||||
if (platformPkg) {
|
if (platformPkg) {
|
||||||
try {
|
try {
|
||||||
const require = createRequire(import.meta.url)
|
const require = createRequire(import.meta.url)
|
||||||
const pkgPath = require.resolve(`${platformPkg}/package.json`)
|
const pkgPath = require.resolve(`${platformPkg}/package.json`)
|
||||||
const pkgDir = dirname(pkgPath)
|
const pkgDir = dirname(pkgPath)
|
||||||
const binaryPath = join(pkgDir, "bin", "comment-checker")
|
const binaryPath = join(pkgDir, "bin", binaryName)
|
||||||
|
|
||||||
if (existsSync(binaryPath)) {
|
if (existsSync(binaryPath)) {
|
||||||
debugLog("found binary in platform package:", binaryPath)
|
debugLog("found binary in platform package:", binaryPath)
|
||||||
|
|||||||
Reference in New Issue
Block a user