Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
12 changes: 7 additions & 5 deletions src/utils/detection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<boolean> {
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);
}