@hasna/skills 0.1.15 → 0.1.17

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.
package/dist/index.js CHANGED
@@ -1524,7 +1524,10 @@ function loadRegistry(cwd) {
1524
1524
  return _registryCache;
1525
1525
  }
1526
1526
  const official = SKILLS.map((s) => ({ ...s, source: "official" }));
1527
- const globalCustom = discoverSkillsInDir(join(homedir(), ".skills"));
1527
+ const globalCustomNew = discoverSkillsInDir(join(homedir(), ".hasna", "skills", "custom"));
1528
+ const globalCustomOld = discoverSkillsInDir(join(homedir(), ".skills"));
1529
+ const oldNames = new Set(globalCustomNew.map((s) => s.name));
1530
+ const globalCustom = [...globalCustomNew, ...globalCustomOld.filter((s) => !oldNames.has(s.name))];
1528
1531
  const projectCustom = discoverSkillsInDir(join(cwd || process.cwd(), ".skills", "custom-skills"));
1529
1532
  const customNames = new Set([...globalCustom, ...projectCustom].map((s) => s.name));
1530
1533
  const filtered = official.filter((s) => !customNames.has(s.name));
@@ -2216,7 +2219,7 @@ function readIfExists(path) {
2216
2219
  return null;
2217
2220
  }
2218
2221
  // src/lib/config.ts
2219
- import { existsSync as existsSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "fs";
2222
+ import { existsSync as existsSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2, copyFileSync } from "fs";
2220
2223
  import { join as join4, dirname as dirname2 } from "path";
2221
2224
  import { homedir as homedir3 } from "os";
2222
2225
  var VALID_KEYS = {
@@ -2224,9 +2227,22 @@ var VALID_KEYS = {
2224
2227
  defaultScope: ["global", "project"],
2225
2228
  format: ["compact", "json", "csv"]
2226
2229
  };
2230
+ function getDataDir() {
2231
+ const home = process.env["HOME"] || process.env["USERPROFILE"] || homedir3();
2232
+ const newDir = join4(home, ".hasna", "skills");
2233
+ const oldConfigFile = join4(home, ".skillsrc");
2234
+ if (existsSync4(oldConfigFile) && !existsSync4(join4(newDir, "config.json"))) {
2235
+ mkdirSync2(newDir, { recursive: true });
2236
+ try {
2237
+ copyFileSync(oldConfigFile, join4(newDir, "config.json"));
2238
+ } catch {}
2239
+ }
2240
+ mkdirSync2(newDir, { recursive: true });
2241
+ return newDir;
2242
+ }
2227
2243
  function getConfigPath(scope) {
2228
2244
  if (scope === "global") {
2229
- return join4(homedir3(), ".skillsrc");
2245
+ return join4(getDataDir(), "config.json");
2230
2246
  }
2231
2247
  return join4(process.cwd(), "skills.config.json");
2232
2248
  }
@@ -3,7 +3,8 @@
3
3
  *
4
4
  * Loads configuration from:
5
5
  * 1. Project-local: ./skills.config.json (highest priority)
6
- * 2. Global: ~/.skillsrc (JSON format, lowest priority)
6
+ * 2. Global: ~/.hasna/skills/config.json (JSON format, lowest priority)
7
+ * (backward compat: also checks ~/.skillsrc)
7
8
  *
8
9
  * Values from the project config override global config.
9
10
  */
@@ -13,6 +14,12 @@ export interface SkillsConfig {
13
14
  format?: "compact" | "json" | "csv";
14
15
  }
15
16
  export type ConfigScope = "global" | "project";
17
+ /**
18
+ * Get the data directory for skills global config/data.
19
+ * New default: ~/.hasna/skills/
20
+ * Auto-migrates from ~/.skillsrc if the new config doesn't exist yet.
21
+ */
22
+ export declare function getDataDir(): string;
16
23
  /**
17
24
  * Get the config file path for a given scope
18
25
  */
@@ -15,7 +15,8 @@ export type Category = (typeof CATEGORIES)[number];
15
15
  export declare const SKILLS: SkillMeta[];
16
16
  /**
17
17
  * Load the full registry: official skills merged with custom skills from:
18
- * - ~/.skills/ (global custom)
18
+ * - ~/.hasna/skills/custom/ (global custom, new path)
19
+ * - ~/.skills/ (global custom, legacy path)
19
20
  * - ./.custom-skills/ (project-level custom, relative to cwd)
20
21
  *
21
22
  * Custom skills with the same name as official skills take precedence.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/skills",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "description": "Skills library for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -60,6 +60,7 @@
60
60
  "typescript": "^5"
61
61
  },
62
62
  "dependencies": {
63
+ "@hasna/cloud": "^0.1.0",
63
64
  "@modelcontextprotocol/sdk": "^1.26.0",
64
65
  "chalk": "^5.3.0",
65
66
  "commander": "^12.1.0",