@hasna/skills 0.8.3 → 0.8.5

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/bin/index.js CHANGED
@@ -36868,7 +36868,7 @@ var package_default;
36868
36868
  var init_package = __esm(() => {
36869
36869
  package_default = {
36870
36870
  name: "@hasna/skills",
36871
- version: "0.8.3",
36871
+ version: "0.8.5",
36872
36872
  description: "Skills library for AI coding agents",
36873
36873
  type: "module",
36874
36874
  bin: {
@@ -50273,8 +50273,8 @@ function configureHermesHooks(text2, supervisor, previous) {
50273
50273
  return doc.toString({ lineWidth: 0 });
50274
50274
  }
50275
50275
  function assertHermesEnvironment(home) {
50276
- if (process.env.TERMINAL_CWD)
50277
- throw new Error("NATIVE_SKILL_DRIFT: Hermes TERMINAL_CWD requires a separately reviewed effective project; unset it before using this adapter");
50276
+ if (process.env.TERMINAL_CWD && process.env.TERMINAL_CWD !== process.cwd())
50277
+ throw new Error("NATIVE_SKILL_DRIFT: Hermes TERMINAL_CWD must match the checked process working directory; review the effective project before using this adapter");
50278
50278
  for (const variable of ["HERMES_BUNDLED_PLUGINS", "HERMES_BUNDLED_SKILLS"]) {
50279
50279
  if (process.env[variable])
50280
50280
  throw new Error(`NATIVE_SKILL_DRIFT: Hermes ${variable} requires a dedicated discovery adapter; unset it before using this adapter`);
@@ -51767,7 +51767,7 @@ function assertManagedAgentBridge(agent, options = {}) {
51767
51767
  if (!isOwnedCliBridge(expected, [expected]))
51768
51768
  throw new Error("NATIVE_SKILL_DRIFT: the native Skills bridge is missing or modified; repair it before continuing");
51769
51769
  const roots = new Set;
51770
- for (const project of [options.projectDir ?? process.cwd(), ...options.projectDirs ?? []]) {
51770
+ for (const project of [options.projectDir ?? process.cwd(), ...options.projectDirs ?? [], ...agent === "hermes" && process.env.TERMINAL_CWD ? [process.cwd()] : []]) {
51771
51771
  for (let path = resolve10(project), depth = 0;; depth++) {
51772
51772
  if (depth >= 100)
51773
51773
  throw new Error("NATIVE_SKILL_DRIFT: project ancestor discovery limit exceeded");
@@ -76989,28 +76989,30 @@ async function buildSkillContext(input2, options = {}) {
76989
76989
  explicit.add(selectionKey(exactProfileSelection(spec, profile)));
76990
76990
  }
76991
76991
  const promptWords = words2(prompt);
76992
+ const promptNames = new Set(prompt.toLowerCase().match(/[a-z0-9]+(?:-[a-z0-9]+)*/g) ?? []);
76992
76993
  const loaded = new Set(resolved.session?.loaded ?? []);
76993
76994
  const paths = [...input2.paths ?? [], ...input2.cwd ? [input2.cwd, resolve11(input2.cwd)] : []];
76994
76995
  const candidates = profile.selections.map((selection) => {
76995
76996
  const key = selectionKey(selection);
76996
76997
  if (input2.restore && loaded.has(key))
76997
- return { selection, reason: "session-restore", score: 2000 };
76998
+ return { selection, reason: "session-restore", priority: 6, score: 2000 };
76998
76999
  if (resolved.inheritedLoaded?.includes(key))
76999
- return { selection, reason: "subagent-inherit", score: 2000 };
77000
+ return { selection, reason: "subagent-inherit", priority: 6, score: 2000 };
77000
77001
  if (explicit.has(key))
77001
- return { selection, reason: "explicit", score: 1000 };
77002
+ return { selection, reason: "explicit", priority: 5, score: 1000 };
77002
77003
  if (selection.triggers?.always)
77003
- return { selection, reason: "profile-required", score: 900 };
77004
+ return { selection, reason: "profile-required", priority: 4, score: 900 };
77004
77005
  const matchedPath = selection.triggers?.paths?.some((pattern) => paths.some((path) => pathMatch(pattern, path)));
77005
77006
  if (matchedPath)
77006
- return { selection, reason: "path", score: 500 };
77007
+ return { selection, reason: "path", priority: 3, score: 500 };
77007
77008
  const keywords = selection.triggers?.keywords ?? selection.slug.split("-").filter((word) => word.length >= 4);
77008
77009
  const matches2 = keywords.filter((keyword) => {
77009
77010
  const tokens = [...words2(keyword)];
77010
77011
  return tokens.length > 0 && tokens.every((token) => promptWords.has(token));
77011
77012
  }).length;
77012
- return { selection, reason: "prompt", score: matches2 * 100 };
77013
- }).filter((candidate) => candidate.score > 0).sort((a, b) => b.score - a.score || a.selection.slug.localeCompare(b.selection.slug));
77013
+ const named = promptNames.has(selection.slug) || selection.aliases?.some((alias) => promptNames.has(alias));
77014
+ return { selection, reason: "prompt", priority: named ? 2 : 1, score: matches2 * 100 };
77015
+ }).filter((candidate) => candidate.score > 0).sort((a, b) => b.priority - a.priority || b.score - a.score || a.selection.slug.localeCompare(b.selection.slug));
77014
77016
  const sections = [];
77015
77017
  const selections = [];
77016
77018
  const omitted = [];
package/bin/mcp.js CHANGED
@@ -20019,7 +20019,7 @@ var package_default;
20019
20019
  var init_package = __esm(() => {
20020
20020
  package_default = {
20021
20021
  name: "@hasna/skills",
20022
- version: "0.8.3",
20022
+ version: "0.8.5",
20023
20023
  description: "Skills library for AI coding agents",
20024
20024
  type: "module",
20025
20025
  bin: {
package/bin/migrate.js CHANGED
@@ -7,7 +7,7 @@ import { join as join5 } from "path";
7
7
  // package.json
8
8
  var package_default = {
9
9
  name: "@hasna/skills",
10
- version: "0.8.3",
10
+ version: "0.8.5",
11
11
  description: "Skills library for AI coding agents",
12
12
  type: "module",
13
13
  bin: {
package/bin/server.js CHANGED
@@ -83749,7 +83749,7 @@ var require_protocols9 = __commonJS((exports) => {
83749
83749
  // package.json
83750
83750
  var package_default = {
83751
83751
  name: "@hasna/skills",
83752
- version: "0.8.3",
83752
+ version: "0.8.5",
83753
83753
  description: "Skills library for AI coding agents",
83754
83754
  type: "module",
83755
83755
  bin: {
package/bin/worker.js CHANGED
@@ -76168,7 +76168,7 @@ import { randomUUID as randomUUID6 } from "crypto";
76168
76168
  // package.json
76169
76169
  var package_default = {
76170
76170
  name: "@hasna/skills",
76171
- version: "0.8.3",
76171
+ version: "0.8.5",
76172
76172
  description: "Skills library for AI coding agents",
76173
76173
  type: "module",
76174
76174
  bin: {
package/dist/index.js CHANGED
@@ -10836,8 +10836,8 @@ function configureHermesHooks(text2, supervisor, previous) {
10836
10836
  return doc.toString({ lineWidth: 0 });
10837
10837
  }
10838
10838
  function assertHermesEnvironment(home) {
10839
- if (process.env.TERMINAL_CWD)
10840
- throw new Error("NATIVE_SKILL_DRIFT: Hermes TERMINAL_CWD requires a separately reviewed effective project; unset it before using this adapter");
10839
+ if (process.env.TERMINAL_CWD && process.env.TERMINAL_CWD !== process.cwd())
10840
+ throw new Error("NATIVE_SKILL_DRIFT: Hermes TERMINAL_CWD must match the checked process working directory; review the effective project before using this adapter");
10841
10841
  for (const variable of ["HERMES_BUNDLED_PLUGINS", "HERMES_BUNDLED_SKILLS"]) {
10842
10842
  if (process.env[variable])
10843
10843
  throw new Error(`NATIVE_SKILL_DRIFT: Hermes ${variable} requires a dedicated discovery adapter; unset it before using this adapter`);
@@ -37660,7 +37660,7 @@ import { dirname as dirname14, relative as relative7 } from "path";
37660
37660
  // package.json
37661
37661
  var package_default = {
37662
37662
  name: "@hasna/skills",
37663
- version: "0.8.3",
37663
+ version: "0.8.5",
37664
37664
  description: "Skills library for AI coding agents",
37665
37665
  type: "module",
37666
37666
  bin: {
@@ -40707,28 +40707,30 @@ async function buildSkillContext(input2, options = {}) {
40707
40707
  explicit.add(selectionKey(exactProfileSelection(spec, profile)));
40708
40708
  }
40709
40709
  const promptWords = words(prompt);
40710
+ const promptNames = new Set(prompt.toLowerCase().match(/[a-z0-9]+(?:-[a-z0-9]+)*/g) ?? []);
40710
40711
  const loaded = new Set(resolved.session?.loaded ?? []);
40711
40712
  const paths = [...input2.paths ?? [], ...input2.cwd ? [input2.cwd, resolve13(input2.cwd)] : []];
40712
40713
  const candidates = profile.selections.map((selection) => {
40713
40714
  const key = selectionKey(selection);
40714
40715
  if (input2.restore && loaded.has(key))
40715
- return { selection, reason: "session-restore", score: 2000 };
40716
+ return { selection, reason: "session-restore", priority: 6, score: 2000 };
40716
40717
  if (resolved.inheritedLoaded?.includes(key))
40717
- return { selection, reason: "subagent-inherit", score: 2000 };
40718
+ return { selection, reason: "subagent-inherit", priority: 6, score: 2000 };
40718
40719
  if (explicit.has(key))
40719
- return { selection, reason: "explicit", score: 1000 };
40720
+ return { selection, reason: "explicit", priority: 5, score: 1000 };
40720
40721
  if (selection.triggers?.always)
40721
- return { selection, reason: "profile-required", score: 900 };
40722
+ return { selection, reason: "profile-required", priority: 4, score: 900 };
40722
40723
  const matchedPath = selection.triggers?.paths?.some((pattern) => paths.some((path) => pathMatch(pattern, path)));
40723
40724
  if (matchedPath)
40724
- return { selection, reason: "path", score: 500 };
40725
+ return { selection, reason: "path", priority: 3, score: 500 };
40725
40726
  const keywords = selection.triggers?.keywords ?? selection.slug.split("-").filter((word) => word.length >= 4);
40726
40727
  const matches = keywords.filter((keyword) => {
40727
40728
  const tokens = [...words(keyword)];
40728
40729
  return tokens.length > 0 && tokens.every((token) => promptWords.has(token));
40729
40730
  }).length;
40730
- return { selection, reason: "prompt", score: matches * 100 };
40731
- }).filter((candidate) => candidate.score > 0).sort((a, b) => b.score - a.score || a.selection.slug.localeCompare(b.selection.slug));
40731
+ const named = promptNames.has(selection.slug) || selection.aliases?.some((alias) => promptNames.has(alias));
40732
+ return { selection, reason: "prompt", priority: named ? 2 : 1, score: matches * 100 };
40733
+ }).filter((candidate) => candidate.score > 0).sort((a, b) => b.priority - a.priority || b.score - a.score || a.selection.slug.localeCompare(b.selection.slug));
40732
40734
  const sections = [];
40733
40735
  const selections = [];
40734
40736
  const omitted = [];
package/dist/sdk/index.js CHANGED
@@ -96141,7 +96141,7 @@ async function resolveExecutionGrant(input) {
96141
96141
  // package.json
96142
96142
  var package_default = {
96143
96143
  name: "@hasna/skills",
96144
- version: "0.8.3",
96144
+ version: "0.8.5",
96145
96145
  description: "Skills library for AI coding agents",
96146
96146
  type: "module",
96147
96147
  bin: {
@@ -96970,8 +96970,8 @@ function configureHermesHooks(text2, supervisor, previous) {
96970
96970
  return doc.toString({ lineWidth: 0 });
96971
96971
  }
96972
96972
  function assertHermesEnvironment(home) {
96973
- if (process.env.TERMINAL_CWD)
96974
- throw new Error("NATIVE_SKILL_DRIFT: Hermes TERMINAL_CWD requires a separately reviewed effective project; unset it before using this adapter");
96973
+ if (process.env.TERMINAL_CWD && process.env.TERMINAL_CWD !== process.cwd())
96974
+ throw new Error("NATIVE_SKILL_DRIFT: Hermes TERMINAL_CWD must match the checked process working directory; review the effective project before using this adapter");
96975
96975
  for (const variable of ["HERMES_BUNDLED_PLUGINS", "HERMES_BUNDLED_SKILLS"]) {
96976
96976
  if (process.env[variable])
96977
96977
  throw new Error(`NATIVE_SKILL_DRIFT: Hermes ${variable} requires a dedicated discovery adapter; unset it before using this adapter`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/skills",
3
- "version": "0.8.3",
3
+ "version": "0.8.5",
4
4
  "description": "Skills library for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {