grix-connector
Version:
Connect local AI coding agents (Claude, Codex, Gemini, Qwen, DeepSeek, Cursor, OpenCode, Pi, OpenHuman, Reasonix) to the Grix scheduling platform. Also serves as an OpenClaw plugin for Grix channel transport.
2 lines (1 loc) • 2.17 kB
JavaScript
import{readFileSync as m,readdirSync as c,existsSync as u,mkdirSync as d,cpSync as p,writeFileSync as k,rmSync as y}from"node:fs";import{join as t,dirname as h}from"node:path";import{homedir as g}from"node:os";import{fileURLToPath as S}from"node:url";import{parseSkillFrontmatter as D}from"../adapter/claude/skill-scanner.js";import{resolveRuntimePaths as x}from"../core/config/index.js";import{log as a}from"../core/log/index.js";const l=h(S(import.meta.url)),f=".grix-managed";function v(){const e=[];let i;try{i=c(l,{withFileTypes:!0,encoding:"utf8"})}catch{return e}for(const r of i){if(!r.isDirectory())continue;const n=t(l,r.name,"SKILL.md");try{const s=m(n,"utf-8"),o=D(s);o?.name&&e.push({name:o.name,description:o.description,trigger:o.trigger,source:"connector"})}catch{}}return e}function K(e){const i=[];let r;try{r=c(l,{withFileTypes:!0,encoding:"utf8"})}catch{return i}for(const n of r){if(!n.isDirectory())continue;const s=t(l,n.name);if(u(t(s,"SKILL.md")))try{d(e,{recursive:!0});const o=t(e,n.name);p(s,o,{recursive:!0}),k(t(o,f),"","utf8"),i.push(n.name)}catch{}}return i}function F(){const e=g(),i=process.env.XDG_CONFIG_HOME||t(e,".config");return[t(x().dataDir,"claude-plugin","skills"),t(e,".codex","skills"),t(e,".gemini","skills"),t(e,".qwen","skills"),t(e,".pi","agent","skills"),t(e,".codewhale","skills"),t(i,"opencode","skills"),t(e,".cursor","skills"),t(e,".openhuman","skills"),t(e,".kiro","skills"),t(e,".reasonix","skills")]}function M(){const e=[];for(const i of F()){let r;try{r=c(i,{withFileTypes:!0,encoding:"utf8"})}catch{continue}for(const n of r){if(!n.isDirectory())continue;const s=t(i,n.name);if(u(t(s,f)))try{y(s,{recursive:!0,force:!0}),e.push(s)}catch{}}}return e.length>0&&a.info("default-skills",`Cleaned ${e.length} projected skill dir(s)`),e}function R(){const e=v();if(e.length===0){a.warn("default-skills","No connector system skills found \u2014 dist/default-skills/ may be missing SKILL.md files");return}a.info("default-skills",`Connector system skills available: [${e.map(i=>i.name).join(", ")}]`)}export{M as cleanupProjectedSkills,R as logDefaultSkillsCheck,v as scanDefaultSkills,K as syncDefaultSkillsToDir};