myrmidocs 0.4.7 → 0.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +88 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -6743,7 +6743,7 @@ async function originResponds(origin) {
6743
6743
  }
6744
6744
 
6745
6745
  // src/version.ts
6746
- var VERSION = true ? "0.4.7" : "0.0.0-dev";
6746
+ var VERSION = true ? "0.4.9" : "0.0.0-dev";
6747
6747
 
6748
6748
  // src/commands/run.ts
6749
6749
  function looksRiskyForBootstrap(dir) {
@@ -7948,7 +7948,7 @@ function candidateSkillsDirs() {
7948
7948
  // Hermes agent (safe default; dir created on first Hermes run)
7949
7949
  ];
7950
7950
  }
7951
- function installSkill() {
7951
+ function installSkillContent(key, content) {
7952
7952
  const dirs = candidateSkillsDirs();
7953
7953
  const written = [];
7954
7954
  for (const dir of dirs) {
@@ -7959,16 +7959,52 @@ function installSkill() {
7959
7959
  continue;
7960
7960
  }
7961
7961
  if (!stat.isDirectory()) continue;
7962
- const skillDir = import_path14.default.join(dir, SKILL_DIR_NAME);
7962
+ const skillDir = import_path14.default.join(dir, key);
7963
7963
  import_fs14.default.mkdirSync(skillDir, { recursive: true });
7964
7964
  const skillPath = import_path14.default.join(skillDir, "SKILL.md");
7965
- import_fs14.default.writeFileSync(skillPath, SKILL_MD, "utf8");
7965
+ import_fs14.default.writeFileSync(skillPath, content, "utf8");
7966
7966
  written.push(skillPath);
7967
7967
  }
7968
7968
  if (written.length > 0) {
7969
7969
  return { installed: true, paths: written, path: written[0] };
7970
7970
  }
7971
- const fallback = import_path14.default.join(dirs[0], SKILL_DIR_NAME, "SKILL.md");
7971
+ const fallback = import_path14.default.join(dirs[0], key, "SKILL.md");
7972
+ return { installed: false, paths: [fallback], path: fallback };
7973
+ }
7974
+ function installSkill() {
7975
+ return installSkillContent(SKILL_DIR_NAME, SKILL_MD);
7976
+ }
7977
+ function isSafeRelPath(p) {
7978
+ if (!p || p.startsWith("/") || p.startsWith("\\")) return false;
7979
+ return !p.split(/[\\/]/).some((seg) => seg === ".." || seg === "");
7980
+ }
7981
+ function installSkillFolder(key, files) {
7982
+ const dirs = candidateSkillsDirs();
7983
+ const written = [];
7984
+ for (const dir of dirs) {
7985
+ let stat;
7986
+ try {
7987
+ stat = import_fs14.default.statSync(dir);
7988
+ } catch {
7989
+ continue;
7990
+ }
7991
+ if (!stat.isDirectory()) continue;
7992
+ const skillDir = import_path14.default.join(dir, key);
7993
+ for (const f of files) {
7994
+ if (!isSafeRelPath(f.path)) continue;
7995
+ const dest = import_path14.default.join(skillDir, f.path);
7996
+ import_fs14.default.mkdirSync(import_path14.default.dirname(dest), { recursive: true });
7997
+ import_fs14.default.writeFileSync(
7998
+ dest,
7999
+ f.encoding === "base64" ? Buffer.from(f.content, "base64") : f.content
8000
+ );
8001
+ }
8002
+ written.push(skillDir);
8003
+ }
8004
+ if (written.length > 0) {
8005
+ return { installed: true, paths: written, path: written[0] };
8006
+ }
8007
+ const fallback = import_path14.default.join(dirs[0], key);
7972
8008
  return { installed: false, paths: [fallback], path: fallback };
7973
8009
  }
7974
8010
 
@@ -8096,6 +8132,52 @@ function registerIdentity(program3) {
8096
8132
  });
8097
8133
  }
8098
8134
 
8135
+ // src/commands/skill.ts
8136
+ async function runSkillList() {
8137
+ const { skills } = await daemonGet(
8138
+ "/api/daemon/skills"
8139
+ );
8140
+ if (!skills.length) {
8141
+ console.log("No skills published in this space yet.");
8142
+ return;
8143
+ }
8144
+ for (const s of skills) {
8145
+ const tags = s.tags?.length ? ` (${s.tags.join(", ")})` : "";
8146
+ console.log(`${s.key} [${s.kind}] ${s.name}${tags}`);
8147
+ if (s.description) console.log(` ${s.description}`);
8148
+ }
8149
+ console.log(`
8150
+ Grab one into your agent: myr skill add <key>`);
8151
+ }
8152
+ async function runSkillAdd(key) {
8153
+ const { packet, files } = await daemonGet(`/api/daemon/skills/${encodeURIComponent(key)}`);
8154
+ const result = installSkillFolder(packet.key, files);
8155
+ if (result.installed) {
8156
+ const n = files.length;
8157
+ console.log(
8158
+ `installed "${packet.key}" (${n} file${n === 1 ? "" : "s"}) -> ${result.paths.join(", ")}`
8159
+ );
8160
+ console.log(
8161
+ "Your agent picks it up on next load. Only this skill was added."
8162
+ );
8163
+ } else {
8164
+ console.log(
8165
+ `No agent skills dir found. Create one (e.g. ~/.claude/skills) and rerun, or save the skill to: ${result.path}`
8166
+ );
8167
+ }
8168
+ }
8169
+ function registerSkill(program3) {
8170
+ const skill = program3.command("skill").description("Browse and grab skills published in this space");
8171
+ skill.command("list").description("List the skills published in this space").action(async () => {
8172
+ await runSkillList();
8173
+ });
8174
+ skill.command("add").description(
8175
+ "Install ONE published skill into your agent's runtime (this skill only, no pollution)"
8176
+ ).argument("<key>", "skill key (from `myr skill list`)").action(async (key) => {
8177
+ await runSkillAdd(key);
8178
+ });
8179
+ }
8180
+
8099
8181
  // src/commands/uninstall.ts
8100
8182
  var import_fs15 = __toESM(require("fs"));
8101
8183
  var import_path15 = __toESM(require("path"));
@@ -8249,6 +8331,7 @@ registerNew(program2);
8249
8331
  registerConnect(program2);
8250
8332
  registerWhoami(program2);
8251
8333
  registerIdentity(program2);
8334
+ registerSkill(program2);
8252
8335
  registerUninstall(program2);
8253
8336
  registerResetConfig(program2);
8254
8337
  program2.parseAsync().catch((err) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myrmidocs",
3
- "version": "0.4.7",
3
+ "version": "0.4.9",
4
4
  "description": "Myrmidocs CLI, AI-first self-hosted knowledge base",
5
5
  "bin": {
6
6
  "myr": "dist/index.js",