Merge pull request 'feat: add Renovate automation for syncing upstream skills' (#1) from feat/renovate-auto-sync into main

This commit was merged in pull request #1.
This commit is contained in:
gitea_1-h.cc committed 2026-10-13 21:14:10 +08:00
commit 5a339c018a
4 files changed
+92 -2

No files matched your search

+4 -2
View File
@@ -7,14 +7,16 @@
"build": "tsc -p tsconfig.json", "build": "tsc -p tsconfig.json",
"plugin:build": "npm run build && openclaw plugins build --entry ./dist/index.js", "plugin:build": "npm run build && openclaw plugins build --entry ./dist/index.js",
"plugin:validate": "npm run build && openclaw plugins validate --entry ./dist/index.js", "plugin:validate": "npm run build && openclaw plugins validate --entry ./dist/index.js",
"test": "vitest run --config ./vitest.config.ts" "test": "vitest run --config ./vitest.config.ts",
"sync:skills": "node scripts/sync-skills.mjs"
}, },
"files": [ "files": [
"dist", "dist",
"src", "src",
"skills", "skills",
"openclaw.plugin.json", "openclaw.plugin.json",
"README.md" "README.md",
"skills.json"
], ],
"peerDependencies": { "peerDependencies": {
"openclaw": ">=2026.5.17" "openclaw": ">=2026.5.17"
+36
View File
@@ -0,0 +1,36 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
],
"customManagers": [
{
"customType": "regex",
"managerFilePatterns": [
"skills\\.json$"
],
"matchStrings": [
"\"//\":\\s*\"renovate:\\s*datasource=(?<datasource>[a-z-]+)\\s+depName=(?<depName>[^\\s]+)\",\\s*\"version\":\\s*\"(?<currentValue>[^\"]+)\""
]
}
],
"packageRules": [
{
"matchDatasources": [
"github-releases"
],
"matchPackageNames": [
"bitwarden/agent-access"
],
"postUpgradeTasks": {
"commands": [
"node scripts/sync-skills.mjs"
],
"fileFilters": [
"skills/**",
"skills.json"
]
}
}
]
}
+42
View File
@@ -0,0 +1,42 @@
import fs from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const rootDir = path.resolve(__dirname, "..");
const configPath = path.join(rootDir, "skills.json");
async function main() {
const raw = await fs.readFile(configPath, "utf-8");
const config = JSON.parse(raw);
console.log(`[sync-skills] Found ${Object.keys(config.skills).length} skill definitions`);
for (const [name, def] of Object.entries(config.skills)) {
const { version, url, destination } = def;
const targetUrl = url.replace("{version}", version);
const destPath = path.join(rootDir, destination);
console.log(`[sync-skills] Syncing ${name} (${version}) from ${targetUrl}...`);
const res = await fetch(targetUrl);
if (!res.ok) {
throw new Error(`Failed to fetch ${targetUrl}: HTTP ${res.status} ${res.statusText}`);
}
const content = await res.text();
if (!content.trim()) {
throw new Error(`Fetched empty content for ${name}`);
}
await fs.mkdir(path.dirname(destPath), { recursive: true });
await fs.writeFile(destPath, content, "utf-8");
console.log(`[sync-skills] ✓ Updated ${destination} (${content.length} bytes)`);
}
console.log("[sync-skills] All skills synced successfully.");
}
main().catch((err) => {
console.error("[sync-skills] Error:", err.message);
process.exit(1);
});
+10
View File
@@ -0,0 +1,10 @@
{
"skills": {
"agent-access": {
"//": "renovate: datasource=github-releases depName=bitwarden/agent-access",
"version": "v0.11.0",
"url": "https://raw.githubusercontent.com/bitwarden/agent-access/{version}/examples/skills/agent-access/SKILL.md",
"destination": "skills/agent-access/SKILL.md"
}
}
}