Files
oh-my-openagent/src/hooks/directory-agents-injector/finder.ts
YeonGyu-Kim a2fd6d77bd docs: update all GitHub URLs from oh-my-opencode to oh-my-openagent
The GitHub repository was renamed from oh-my-opencode to oh-my-openagent,
but all documentation, scripts, and source code references still pointed
to the old repository name. This caused confusion for users who saw
'oh-my-opencode' in docs but a different repo name on GitHub.

Updated all references across:
- README files (en, ko, ja, zh-cn, ru)
- CONTRIBUTING.md
- docs/ (installation, overview, configuration, etc.)
- Source code (schema URLs, GitHub API calls, issue links)
- Test snapshots

The npm package name remains 'oh-my-opencode' (unchanged).

Fixes: https://x.com/Dhruv14588676/status/2031216617762468348
2026-03-10 15:18:16 +09:00

39 lines
1.1 KiB
TypeScript

import { existsSync } from "node:fs";
import { dirname, isAbsolute, join, resolve } from "node:path";
import { AGENTS_FILENAME } from "./constants";
export function resolveFilePath(rootDirectory: string, path: string): string | null {
if (!path) return null;
if (isAbsolute(path)) return path;
return resolve(rootDirectory, path);
}
export function findAgentsMdUp(input: {
startDir: string;
rootDir: string;
}): string[] {
const found: string[] = [];
let current = input.startDir;
while (true) {
// Skip root AGENTS.md - OpenCode's system.ts already loads it via custom()
// See: https://github.com/code-yeongyu/oh-my-openagent/issues/379
const isRootDir = current === input.rootDir;
if (!isRootDir) {
const agentsPath = join(current, AGENTS_FILENAME);
if (existsSync(agentsPath)) {
found.push(agentsPath);
}
}
if (isRootDir) break;
const parent = dirname(current);
if (parent === current) break;
if (!parent.startsWith(input.rootDir)) break;
current = parent;
}
return found.reverse();
}