aboutsummaryrefslogtreecommitdiff
path: root/modules/ext
diff options
context:
space:
mode:
authorAgando <roduccomm@gmail.com>2026-06-06 18:01:01 +0200
committerAgando <roduccomm@gmail.com>2026-06-06 18:01:01 +0200
commit021aa37d540353553bc60c28d78e35c828c58458 (patch)
tree886218ed4bfc9b4d779b3565cdcc6d0fe981ade8 /modules/ext
parentccc7d9956559d2195e20345e7a794662b52cd403 (diff)
auto: 2026-06-06_18:01 changes
Diffstat (limited to 'modules/ext')
-rw-r--r--modules/ext/skill-pack-core.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/modules/ext/skill-pack-core.js b/modules/ext/skill-pack-core.js
index 41844bd..6f7ad4c 100644
--- a/modules/ext/skill-pack-core.js
+++ b/modules/ext/skill-pack-core.js
@@ -29,6 +29,7 @@ class SkillPackCoreModule {
'skill-export': 'skill-export <name> — Export a skill as JSON',
'skill-import': 'skill-import <json> — Import a skill from JSON string',
'skill-sync': 'skill-sync — Rebuild skills index from /skills/ directory',
+ 'skill-webdav-sync': 'skill-webdav-sync — Push all skills to WebDAV as JSON files',
};
}
@@ -487,6 +488,7 @@ class SkillPackCoreModule {
this.commands['skill-export'] = (args) => this._cmdSkillExport(args);
this.commands['skill-import'] = (args) => this._cmdSkillImport(args);
this.commands['skill-sync'] = () => this._cmdSkillSync();
+ this.commands['skill-webdav-sync'] = () => this._cmdSkillWebdavSync();
}
// ── Skill Commands ──
@@ -690,6 +692,46 @@ class SkillPackCoreModule {
this.terminal.print(`📚 Skill index rebuilt: ${synced} skills synced`, 'success');
}
+ async _cmdSkillWebdavSync() {
+ const fs = this.terminal.fs;
+ const index = fs.fsReadJSON('/skills/index.json') || {};
+ const names = Object.keys(index);
+ if (names.length === 0) {
+ this.terminal.print('No skills to sync', 'info');
+ return;
+ }
+ // Find the webdav module
+ const webdavMod = this.terminal.moduleManager.modules['WebDAVModule'];
+ if (!webdavMod || !webdavMod._webdavRequest) {
+ this.terminal.print('WebDAV module not loaded. Configure webdav first with webdav-config', 'warning');
+ return;
+ }
+ this.terminal.print(`📤 Syncing ${names.length} skills to WebDAV...`, 'info');
+ let ok = 0, fail = 0;
+ await webdavMod._ensureDir('skills');
+ for (const name of names) {
+ const content = fs.readFile(`/skills/${name}.md`);
+ if (content === null) { fail++; continue; }
+ const meta = index[name];
+ const exportObj = { ...meta, content };
+ const json = JSON.stringify(exportObj, null, 2);
+ try {
+ const resp = await webdavMod._webdavRequest('PUT', 'skills/' + name + '.json', {
+ body: json,
+ headers: { 'Content-Type': 'application/json' }
+ });
+ if (resp.ok || resp.status === 201 || resp.status === 204) {
+ ok++;
+ } else {
+ fail++;
+ }
+ } catch (e) {
+ fail++;
+ }
+ }
+ this.terminal.print(`📤 Skill WebDAV sync complete: ${ok} pushed, ${fail} failed`, fail > 0 ? 'warning' : 'success');
+ }
+
init() {
this.seed();
}