From eb8068ca4d0b7e7a95691aa6f9d4d0048dc9e350 Mon Sep 17 00:00:00 2001 From: octane0411 Date: Mon, 2 Feb 2026 15:58:11 +0800 Subject: [PATCH] fix: support new OpenSpec OPSX detection via config.yaml OpenSpec has migrated to OPSX which uses openspec/config.yaml instead of AGENTS.md for project detection. This change adds support for the new format while maintaining backward compatibility with legacy projects. Bump version to 0.1.2 Fixes #4 --- package.json | 2 +- src/utils/detection.ts | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 58a8dd4..dd1ff6c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "opencode-plugin-openspec", - "version": "0.1.1", + "version": "0.1.2", "description": "An OpenCode plugin that integrates OpenSpec, providing a dedicated agent for planning and specifying software architecture.", "type": "module", "main": "dist/index.js", diff --git a/src/utils/detection.ts b/src/utils/detection.ts index e3ff034..b36daf2 100644 --- a/src/utils/detection.ts +++ b/src/utils/detection.ts @@ -4,13 +4,15 @@ import { join } from "node:path"; /** * Checks if the current workspace is an OpenSpec project. - * + * * Detection logic: - * 1. Checks for `openspec/AGENTS.md` (Primary indicator) - * 2. Checks for `AGENTS.md` in root (Secondary indicator) + * 1. Checks for `openspec/config.yaml` (Primary indicator - new OPSX format) + * 2. Checks for `openspec/AGENTS.md` (Fallback - legacy format) */ export async function isOpenSpecProject(ctx: PluginInput): Promise { - const openspecAgentsPath = join(ctx.directory, "openspec", "AGENTS.md"); + const openspecDir = join(ctx.directory, "openspec"); + const configYamlPath = join(openspecDir, "config.yaml"); + const agentsMdPath = join(openspecDir, "AGENTS.md"); - return existsSync(openspecAgentsPath); + return existsSync(configYamlPath) || existsSync(agentsMdPath); }