mirror of
https://github.com/rohitg00/skillkit.git
synced 2026-11-18 18:04:26 +00:00
fix(openclaw): align paths with upstream openclaw/openclaw conventions (#117)
* fix(openclaw): align paths with upstream openclaw/openclaw conventions - skillsDir: 'skills' -> '.openclaw/skills' (match project-scoped convention) - configFile: 'CLAUDE.md' -> 'AGENTS.md' (upstream uses AGENTS.md/SOUL.md) - globalSkillsDir: '~/.openclaw/skills' -> '~/.openclaw/workspace/skills' - altSkillsDirs: keep 'skills' for back-compat, add workspace variant - isDetected: also check project .openclaw/ and global workspace/ - MCP AGENT_DIR_MAP: .openclaw/skills for runtime discovery - README: reflect real paths Refs NousResearch upstream layout; pairs with #114 Hermes support. * fix(openclaw): address review findings for discovery + detection - skills.ts: add '.openclaw/skills' to SKILL_DISCOVERY_PATHS (alphabetical) - config.ts: getSearchDirs prefers globalSkillsDir for home path (was deriving from skillsDir, producing ~/.openclaw/skills instead of ~/.openclaw/workspace/skills) - agent-config.ts: add altConfigFiles to AgentDirectoryConfig schema, set openclaw altConfigFiles: ['openclaw.json'] - context/sync.ts: detectAgents also iterates altConfigFiles so projects with only openclaw.json still detected - mcp/tools.ts: AGENT_DIR_MAP includes '.openclaw/workspace/skills' for home-rooted global discovery
This commit is contained in:
@@ -23,7 +23,7 @@ npm install @skillkit/agents
|
||||
| Antigravity | SKILL.md | `.antigravity/skills/` | - |
|
||||
| Amp | SKILL.md | `.amp/skills/` | - |
|
||||
| Clawdbot | SKILL.md | `.clawdbot/skills/` | - |
|
||||
| OpenClaw | SKILL.md | `skills/` | - |
|
||||
| OpenClaw | SKILL.md | `.openclaw/skills/` | `~/.openclaw/workspace/skills/` |
|
||||
| Cline | SKILL.md | `.cline/skills/` | - |
|
||||
| CodeBuddy | SKILL.md | `.codebuddy/skills/` | - |
|
||||
| CodeGPT | SKILL.md | `.codegpt/skills/` | - |
|
||||
|
||||
@@ -14,9 +14,12 @@ export class OpenClawAdapter extends ClawdbotAdapter {
|
||||
override readonly configFile = config.configFile;
|
||||
|
||||
override async isDetected(): Promise<boolean> {
|
||||
const projectOpenClaw = join(process.cwd(), '.openclaw');
|
||||
const globalOpenClaw = join(homedir(), '.openclaw');
|
||||
const globalWorkspace = join(homedir(), '.openclaw', 'workspace');
|
||||
const openclawConfig = join(process.cwd(), 'openclaw.json');
|
||||
|
||||
return existsSync(globalOpenClaw) || existsSync(openclawConfig);
|
||||
return existsSync(projectOpenClaw) || existsSync(globalOpenClaw) ||
|
||||
existsSync(globalWorkspace) || existsSync(openclawConfig);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ export interface AgentDirectoryConfig {
|
||||
skillsDir: string;
|
||||
/** Config file that references skills */
|
||||
configFile: string;
|
||||
/** Alternative config files that also mark this agent as present */
|
||||
altConfigFiles?: string[];
|
||||
/** Alternative skills directories */
|
||||
altSkillsDirs?: string[];
|
||||
/** Global skills directory */
|
||||
@@ -121,10 +123,11 @@ export const AGENT_CONFIG: Record<AgentType, AgentDirectoryConfig> = {
|
||||
},
|
||||
|
||||
openclaw: {
|
||||
skillsDir: 'skills',
|
||||
configFile: 'CLAUDE.md',
|
||||
altSkillsDirs: ['~/.openclaw/skills'],
|
||||
globalSkillsDir: '~/.openclaw/skills',
|
||||
skillsDir: '.openclaw/skills',
|
||||
configFile: 'AGENTS.md',
|
||||
altConfigFiles: ['openclaw.json'],
|
||||
altSkillsDirs: ['skills', '~/.openclaw/workspace/skills'],
|
||||
globalSkillsDir: '~/.openclaw/workspace/skills',
|
||||
configFormat: 'xml',
|
||||
usesFrontmatter: true,
|
||||
frontmatterFields: [
|
||||
|
||||
@@ -4,6 +4,7 @@ import { homedir } from 'node:os';
|
||||
import { createHash } from 'node:crypto';
|
||||
import { parse as parseYaml, stringify as stringifyYaml } from 'yaml';
|
||||
import { SkillkitConfig, LockFile, type AgentType, type SkillMetadata, type AgentAdapterInfo, type LockEntry } from './types.js';
|
||||
import { AGENT_CONFIG } from './agent-config.js';
|
||||
|
||||
const CONFIG_FILE = 'skillkit.yaml';
|
||||
const METADATA_FILE = '.skillkit.json';
|
||||
@@ -99,7 +100,16 @@ export function getSearchDirs(adapter: AgentAdapterInfo): string[] {
|
||||
|
||||
dirs.push(join(process.cwd(), adapter.skillsDir));
|
||||
dirs.push(join(process.cwd(), '.agent', 'skills'));
|
||||
dirs.push(join(homedir(), adapter.skillsDir));
|
||||
|
||||
const globalDir = AGENT_CONFIG[adapter.type]?.globalSkillsDir;
|
||||
if (globalDir) {
|
||||
const resolved = globalDir.startsWith('~/')
|
||||
? join(homedir(), globalDir.slice(2))
|
||||
: globalDir;
|
||||
dirs.push(resolved);
|
||||
} else {
|
||||
dirs.push(join(homedir(), adapter.skillsDir));
|
||||
}
|
||||
dirs.push(join(homedir(), '.agent', 'skills'));
|
||||
|
||||
return dirs;
|
||||
|
||||
@@ -55,8 +55,11 @@ export class ContextSync {
|
||||
const skillsPath = join(this.projectPath, config.skillsDir);
|
||||
const configPath = join(this.projectPath, config.configFile);
|
||||
|
||||
// Check if either skills directory or config file exists
|
||||
if (existsSync(skillsPath) || existsSync(configPath)) {
|
||||
const altConfigExists = (config.altConfigFiles ?? []).some((alt) =>
|
||||
existsSync(join(this.projectPath, alt))
|
||||
);
|
||||
|
||||
if (existsSync(skillsPath) || existsSync(configPath) || altConfigExists) {
|
||||
detected.push(agent as AgentType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ export const SKILL_DISCOVERY_PATHS = [
|
||||
'.mux/skills',
|
||||
'.neovate/skills',
|
||||
'.opencode/skills',
|
||||
'.openclaw/skills',
|
||||
'.openhands/skills',
|
||||
'.pi/skills',
|
||||
'.playcode/skills',
|
||||
|
||||
@@ -185,7 +185,7 @@ const AGENT_DIR_MAP: Record<string, string[]> = {
|
||||
'claude-code': ['.claude/skills'], 'cursor': ['.cursor/skills'], 'codex': ['.codex/skills'],
|
||||
'gemini-cli': ['.gemini/skills'], 'opencode': ['.opencode/skills', '.config/opencode/skills'],
|
||||
'antigravity': ['.antigravity/skills'], 'amp': ['.amp/skills'], 'clawdbot': ['.clawdbot/skills'],
|
||||
'openclaw': ['skills'], 'github-copilot': ['.github/skills'], 'goose': ['.goose/skills'],
|
||||
'openclaw': ['.openclaw/skills', '.openclaw/workspace/skills', 'skills'], 'github-copilot': ['.github/skills'], 'goose': ['.goose/skills'],
|
||||
'kilo': ['.kilocode/skills'], 'kiro-cli': ['.kiro/skills'], 'roo': ['.roo/skills'],
|
||||
'trae': ['.trae/skills'], 'windsurf': ['.windsurf/skills', '.codeium/windsurf/skills'],
|
||||
'universal': ['skills'], 'droid': ['.factory/skills'], 'factory': ['.factory/skills'],
|
||||
|
||||
Reference in New Issue
Block a user