@skill-map/cli 0.35.0 → 0.36.0

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
@@ -94,14 +94,14 @@ var Registry = class {
94
94
 
95
95
  // kernel/orchestrator/index.ts
96
96
  import { existsSync as existsSync11, statSync as statSync4 } from "fs";
97
- import { isAbsolute as isAbsolute4, resolve as resolve10 } from "path";
97
+ import { isAbsolute as isAbsolute4, resolve as resolve11 } from "path";
98
98
  import { Tiktoken as Tiktoken2 } from "js-tiktoken/lite";
99
99
  import cl100k_base from "js-tiktoken/ranks/cl100k_base";
100
100
 
101
101
  // package.json
102
102
  var package_default = {
103
103
  name: "@skill-map/cli",
104
- version: "0.35.0",
104
+ version: "0.36.0",
105
105
  description: "skill-map reference implementation \u2014 kernel + CLI + adapters.",
106
106
  license: "MIT",
107
107
  type: "module",
@@ -1051,7 +1051,13 @@ function loadConfigForScope(opts) {
1051
1051
  // core/config/active-provider.ts
1052
1052
  var DETECTION_RULES = [
1053
1053
  { providerId: "claude", marker: ".claude" },
1054
- { providerId: "gemini", marker: ".gemini" },
1054
+ // `gemini` retired 2026-05-22: Google replaced the Gemini CLI with the
1055
+ // Antigravity CLI (released 2026-05-19; Gemini CLI sunsets 2026-06-18).
1056
+ // Antigravity adopted the open-standard `.agents/` instead of a
1057
+ // vendor-specific directory, so detection of a Google CLI project
1058
+ // falls through to the universal `agent-skills` lens (`.agents/`
1059
+ // already classifies via that neutral provider). The lens can still
1060
+ // be set manually via `sm config set activeProvider antigravity`.
1055
1061
  { providerId: "openai", marker: ".codex" },
1056
1062
  { providerId: "openai", marker: "AGENTS.md" },
1057
1063
  { providerId: "cursor", marker: ".cursor" }
@@ -1429,7 +1435,7 @@ function isExternalUrlLink(link) {
1429
1435
  }
1430
1436
 
1431
1437
  // kernel/orchestrator/analyzers.ts
1432
- async function runAnalyzers(analyzers, nodes, internalLinks, orphanSidecars, sidecarRoots, annotationContributions, viewContributions, orphanJobFiles, referenceablePaths, cwd, registeredActionIds, emitter, hookDispatcher) {
1438
+ async function runAnalyzers(analyzers, nodes, internalLinks, orphanSidecars, sidecarRoots, annotationContributions, viewContributions, orphanJobFiles, referenceablePaths, cwd, registeredActionIds, emitter, hookDispatcher, reservedNodePaths) {
1433
1439
  const issues = [];
1434
1440
  const contributions = [];
1435
1441
  const validators = loadSchemaValidators();
@@ -1493,6 +1499,7 @@ async function runAnalyzers(analyzers, nodes, internalLinks, orphanSidecars, sid
1493
1499
  orphanJobFiles,
1494
1500
  ...referenceablePaths ? { referenceablePaths } : {},
1495
1501
  ...cwd ? { cwd } : {},
1502
+ ...reservedNodePaths ? { reservedNodePaths } : {},
1496
1503
  emitContribution
1497
1504
  });
1498
1505
  for (const issue of emitted) {
@@ -1713,7 +1720,7 @@ function classifyLinkSource(source, shortIdToQualified, cachedQualifiedIds, appl
1713
1720
  return "obsolete";
1714
1721
  }
1715
1722
 
1716
- // kernel/orchestrator/lift-resolved-link-confidence.ts
1723
+ // kernel/orchestrator/node-identifiers.ts
1717
1724
  import { posix as pathPosix } from "path";
1718
1725
 
1719
1726
  // kernel/trigger-normalize.ts
@@ -1726,14 +1733,53 @@ function normalizeTrigger(source) {
1726
1733
  return out.trim();
1727
1734
  }
1728
1735
 
1736
+ // kernel/orchestrator/node-identifiers.ts
1737
+ function deriveNodeIdentifiers(node, kindDescriptor) {
1738
+ const sources = kindDescriptor?.identifiers;
1739
+ if (!sources || sources.length === 0) return [];
1740
+ const out = [];
1741
+ for (const source of sources) {
1742
+ const raw = readIdentifier(source, node);
1743
+ if (!raw) continue;
1744
+ const normalised = normalizeTrigger(raw);
1745
+ if (normalised) out.push(normalised);
1746
+ }
1747
+ return out;
1748
+ }
1749
+ function readIdentifier(source, node) {
1750
+ if (source === "frontmatter.name") return readFrontmatterName(node);
1751
+ if (source === "filename-basename") return readFilenameBasename(node);
1752
+ return readDirname(node);
1753
+ }
1754
+ function readFrontmatterName(node) {
1755
+ const raw = node.frontmatter?.["name"];
1756
+ if (typeof raw !== "string") return null;
1757
+ return raw.length > 0 ? raw : null;
1758
+ }
1759
+ function readFilenameBasename(node) {
1760
+ const base = pathPosix.basename(node.path);
1761
+ if (!base) return null;
1762
+ const ext = pathPosix.extname(base);
1763
+ const stem = ext ? base.slice(0, -ext.length) : base;
1764
+ return stem.length > 0 ? stem : null;
1765
+ }
1766
+ function readDirname(node) {
1767
+ const dir = pathPosix.dirname(node.path);
1768
+ if (!dir || dir === "." || dir === "/") return null;
1769
+ const base = pathPosix.basename(dir);
1770
+ return base.length > 0 ? base : null;
1771
+ }
1772
+
1729
1773
  // kernel/orchestrator/lift-resolved-link-confidence.ts
1774
+ var RESERVED_TARGET_CONFIDENCE = 0.1;
1730
1775
  function liftResolvedLinkConfidence(links, nodes, ctx) {
1731
1776
  if (!links.some((l) => l.confidence < 1)) return;
1732
1777
  const indexes = buildIndexes(nodes, ctx);
1733
1778
  for (const link of links) {
1734
- if (link.confidence < 1 && resolves(link, indexes, ctx)) {
1735
- link.confidence = 1;
1736
- }
1779
+ if (link.confidence >= 1) continue;
1780
+ const resolution = resolve7(link, indexes, ctx);
1781
+ if (resolution === "none") continue;
1782
+ link.confidence = ctx.reservedNodePaths.has(resolution) ? RESERVED_TARGET_CONFIDENCE : 1;
1737
1783
  }
1738
1784
  }
1739
1785
  function buildIndexes(nodes, ctx) {
@@ -1747,18 +1793,19 @@ function buildIndexes(nodes, ctx) {
1747
1793
  }
1748
1794
  return { byPath: byPath2, byName, nodeByPath };
1749
1795
  }
1750
- function resolves(link, indexes, ctx) {
1751
- if (indexes.byPath.has(link.target)) return true;
1752
- return resolvesByName(link, indexes, ctx);
1796
+ function resolve7(link, indexes, ctx) {
1797
+ if (indexes.byPath.has(link.target)) return link.target;
1798
+ return resolveByName(link, indexes, ctx);
1753
1799
  }
1754
- function resolvesByName(link, indexes, ctx) {
1800
+ function resolveByName(link, indexes, ctx) {
1755
1801
  const stripped = stripTriggerSigil(link.trigger?.normalizedTrigger);
1756
- if (stripped === null) return false;
1802
+ if (stripped === null) return "none";
1757
1803
  const candidates = indexes.byName.get(stripped);
1758
- if (!candidates?.length) return false;
1804
+ if (!candidates?.length) return "none";
1759
1805
  const allowedKinds = lookupAllowedKinds(link, indexes, ctx);
1760
- if (!allowedKinds?.length) return false;
1761
- return candidates.some((c) => allowedKinds.includes(c.kind));
1806
+ if (!allowedKinds?.length) return "none";
1807
+ const winner = candidates.find((c) => allowedKinds.includes(c.kind));
1808
+ return winner ? winner.path : "none";
1762
1809
  }
1763
1810
  function lookupAllowedKinds(link, indexes, ctx) {
1764
1811
  const sourceNode = indexes.nodeByPath.get(link.source);
@@ -1772,44 +1819,17 @@ function stripTriggerSigil(normalized) {
1772
1819
  }
1773
1820
  function indexNode(node, ctx, byName) {
1774
1821
  const kindDescriptor = ctx.kindRegistry.get(kindKey(node));
1775
- const sources = kindDescriptor?.identifiers;
1776
- if (!sources || sources.length === 0) return;
1777
- for (const source of sources) {
1778
- const raw = deriveIdentifier(source, node);
1779
- if (!raw) continue;
1780
- const normalized = normalizeTrigger(raw);
1781
- if (!normalized) continue;
1782
- const bucket = byName.get(normalized);
1822
+ const normalised = deriveNodeIdentifiers(node, kindDescriptor);
1823
+ for (const name of normalised) {
1824
+ const entry = { kind: node.kind, path: node.path };
1825
+ const bucket = byName.get(name);
1783
1826
  if (bucket) {
1784
- bucket.push({ kind: node.kind });
1827
+ bucket.push(entry);
1785
1828
  } else {
1786
- byName.set(normalized, [{ kind: node.kind }]);
1829
+ byName.set(name, [entry]);
1787
1830
  }
1788
1831
  }
1789
1832
  }
1790
- function deriveIdentifier(source, node) {
1791
- if (source === "frontmatter.name") return readFrontmatterName(node);
1792
- if (source === "filename-basename") return readFilenameBasename(node);
1793
- return readDirname(node);
1794
- }
1795
- function readFrontmatterName(node) {
1796
- const raw = node.frontmatter?.["name"];
1797
- if (typeof raw !== "string") return null;
1798
- return raw.length > 0 ? raw : null;
1799
- }
1800
- function readFilenameBasename(node) {
1801
- const base = pathPosix.basename(node.path);
1802
- if (!base) return null;
1803
- const ext = pathPosix.extname(base);
1804
- const stem = ext ? base.slice(0, -ext.length) : base;
1805
- return stem.length > 0 ? stem : null;
1806
- }
1807
- function readDirname(node) {
1808
- const dir = pathPosix.dirname(node.path);
1809
- if (!dir || dir === "." || dir === "/") return null;
1810
- const base = pathPosix.basename(dir);
1811
- return base.length > 0 ? base : null;
1812
- }
1813
1833
  function kindKey(node) {
1814
1834
  return `${node.provider}/${node.kind}`;
1815
1835
  }
@@ -1978,7 +1998,7 @@ import { join as join7, relative as relative2, sep } from "path";
1978
1998
 
1979
1999
  // kernel/scan/ignore.ts
1980
2000
  import { existsSync as existsSync6, readFileSync as readFileSync7 } from "fs";
1981
- import { dirname as dirname4, resolve as resolve7 } from "path";
2001
+ import { dirname as dirname4, resolve as resolve8 } from "path";
1982
2002
  import { fileURLToPath } from "url";
1983
2003
  import ignoreFactory from "ignore";
1984
2004
  function buildIgnoreFilter(opts = {}) {
@@ -2012,11 +2032,11 @@ function loadDefaultsText() {
2012
2032
  function readDefaultsFromDisk() {
2013
2033
  const here = dirname4(fileURLToPath(import.meta.url));
2014
2034
  const candidates = [
2015
- resolve7(here, "../../config/defaults/skillmapignore"),
2035
+ resolve8(here, "../../config/defaults/skillmapignore"),
2016
2036
  // src/kernel/scan/ → src/config/defaults/
2017
- resolve7(here, "../config/defaults/skillmapignore"),
2037
+ resolve8(here, "../config/defaults/skillmapignore"),
2018
2038
  // dist/cli.js → dist/config/defaults/ (siblings)
2019
- resolve7(here, "config/defaults/skillmapignore")
2039
+ resolve8(here, "config/defaults/skillmapignore")
2020
2040
  ];
2021
2041
  for (const candidate of candidates) {
2022
2042
  if (existsSync6(candidate)) {
@@ -2207,7 +2227,7 @@ function resolveProviderWalk(provider) {
2207
2227
 
2208
2228
  // kernel/sidecar/parse.ts
2209
2229
  import { existsSync as existsSync7, readFileSync as readFileSync8 } from "fs";
2210
- import { dirname as dirname5, resolve as resolve8 } from "path";
2230
+ import { dirname as dirname5, resolve as resolve9 } from "path";
2211
2231
  import { createRequire as createRequire3 } from "module";
2212
2232
  import { Ajv2020 as Ajv20204 } from "ajv/dist/2020.js";
2213
2233
  import yaml2 from "js-yaml";
@@ -2286,10 +2306,10 @@ function getSidecarValidator() {
2286
2306
  applyAjvFormats(ajv);
2287
2307
  const specRoot = resolveSpecRoot2();
2288
2308
  const annotationsSchema = JSON.parse(
2289
- readFileSync8(resolve8(specRoot, "schemas/annotations.schema.json"), "utf8")
2309
+ readFileSync8(resolve9(specRoot, "schemas/annotations.schema.json"), "utf8")
2290
2310
  );
2291
2311
  const sidecarSchema = JSON.parse(
2292
- readFileSync8(resolve8(specRoot, "schemas/sidecar.schema.json"), "utf8")
2312
+ readFileSync8(resolve9(specRoot, "schemas/sidecar.schema.json"), "utf8")
2293
2313
  );
2294
2314
  ajv.addSchema(annotationsSchema);
2295
2315
  cachedSidecarValidator = ajv.compile(sidecarSchema);
@@ -2360,7 +2380,7 @@ function safeIsFile(path) {
2360
2380
 
2361
2381
  // kernel/sidecar/store.ts
2362
2382
  import { existsSync as existsSync9, readFileSync as readFileSync9 } from "fs";
2363
- import { dirname as dirname6, resolve as resolve9 } from "path";
2383
+ import { dirname as dirname6, resolve as resolve10 } from "path";
2364
2384
  import { createRequire as createRequire4 } from "module";
2365
2385
  import { Ajv2020 as Ajv20205 } from "ajv/dist/2020.js";
2366
2386
  import yaml3 from "js-yaml";
@@ -2904,7 +2924,7 @@ async function runScanInternal(_kernel, options) {
2904
2924
  pluginStores: options.pluginStores,
2905
2925
  activeProvider: resolveActiveProviderOption(options.activeProvider, options.roots)
2906
2926
  });
2907
- const postWalkCtx = buildPostWalkTransformCtx(_kernel);
2927
+ const postWalkCtx = buildPostWalkTransformCtx(_kernel, walked.nodes);
2908
2928
  walked.internalLinks = applyPostWalkTransforms(walked.internalLinks, walked.nodes, postWalkCtx);
2909
2929
  recomputeLinkCounts(walked.nodes, walked.internalLinks);
2910
2930
  recomputeExternalRefsCount(walked.nodes, walked.externalLinks, walked.cachedPaths);
@@ -2925,7 +2945,8 @@ async function runScanInternal(_kernel, options) {
2925
2945
  options.cwd,
2926
2946
  registeredActionIds,
2927
2947
  emitter,
2928
- hookDispatcher
2948
+ hookDispatcher,
2949
+ postWalkCtx.reservedNodePaths
2929
2950
  );
2930
2951
  mergeAnalyzerEmissions(walked, analyzerResult, exts.analyzers);
2931
2952
  const issues = analyzerResult.issues;
@@ -2938,9 +2959,19 @@ async function runScanInternal(_kernel, options) {
2938
2959
  await hookDispatcher.dispatch("scan.completed", scanCompletedEvent);
2939
2960
  return buildScanReturn(walked, issues, renameOps, stats, options, setup);
2940
2961
  }
2941
- function buildPostWalkTransformCtx(kernel) {
2962
+ function buildPostWalkTransformCtx(kernel, nodes) {
2963
+ const { kindRegistry, providerResolution, reservedNamesByProviderKind } = buildProviderIndexes(kernel);
2964
+ const reservedNodePaths = buildReservedNodePaths(
2965
+ nodes,
2966
+ kindRegistry,
2967
+ reservedNamesByProviderKind
2968
+ );
2969
+ return { kindRegistry, providerResolution, reservedNodePaths };
2970
+ }
2971
+ function buildProviderIndexes(kernel) {
2942
2972
  const kindRegistry = /* @__PURE__ */ new Map();
2943
2973
  const providerResolution = /* @__PURE__ */ new Map();
2974
+ const reservedNamesByProviderKind = /* @__PURE__ */ new Map();
2944
2975
  const providers = kernel.registry.all("provider");
2945
2976
  for (const provider of providers) {
2946
2977
  if (provider.kinds) {
@@ -2951,8 +2982,32 @@ function buildPostWalkTransformCtx(kernel) {
2951
2982
  if (provider.resolution) {
2952
2983
  providerResolution.set(provider.id, provider.resolution);
2953
2984
  }
2985
+ if (provider.reservedNames) {
2986
+ indexReservedNames(provider, reservedNamesByProviderKind);
2987
+ }
2954
2988
  }
2955
- return { kindRegistry, providerResolution };
2989
+ return { kindRegistry, providerResolution, reservedNamesByProviderKind };
2990
+ }
2991
+ function indexReservedNames(provider, out) {
2992
+ for (const [kindName, list] of Object.entries(provider.reservedNames ?? {})) {
2993
+ const normalised = new Set(list.map((raw) => normalizeTrigger(raw)).filter(Boolean));
2994
+ if (normalised.size > 0) {
2995
+ out.set(`${provider.id}/${kindName}`, normalised);
2996
+ }
2997
+ }
2998
+ }
2999
+ function buildReservedNodePaths(nodes, kindRegistry, reservedNamesByProviderKind) {
3000
+ const out = /* @__PURE__ */ new Set();
3001
+ for (const node of nodes) {
3002
+ const key = `${node.provider}/${node.kind}`;
3003
+ const reservedSet = reservedNamesByProviderKind.get(key);
3004
+ if (!reservedSet || reservedSet.size === 0) continue;
3005
+ const ids = deriveNodeIdentifiers(node, kindRegistry.get(key));
3006
+ if (ids.some((id) => reservedSet.has(id))) {
3007
+ out.add(node.path);
3008
+ }
3009
+ }
3010
+ return out;
2956
3011
  }
2957
3012
  function buildScanSetup(options) {
2958
3013
  const start = Date.now();
@@ -3045,7 +3100,7 @@ function validateRoots(roots) {
3045
3100
  function resolveActiveProviderOption(optionValue, roots) {
3046
3101
  if (optionValue !== void 0) return optionValue;
3047
3102
  for (const root of roots) {
3048
- const absRoot = isAbsolute4(root) ? root : resolve10(root);
3103
+ const absRoot = isAbsolute4(root) ? root : resolve11(root);
3049
3104
  if (!existsSync11(absRoot)) continue;
3050
3105
  const detected = resolveActiveProvider(absRoot).resolved;
3051
3106
  if (detected !== null) return detected;
@@ -3054,10 +3109,10 @@ function resolveActiveProviderOption(optionValue, roots) {
3054
3109
  }
3055
3110
 
3056
3111
  // kernel/scan/watcher.ts
3057
- import { resolve as resolve11, relative as relative4, sep as sep3 } from "path";
3112
+ import { resolve as resolve12, relative as relative4, sep as sep3 } from "path";
3058
3113
  import chokidar from "chokidar";
3059
3114
  function createChokidarWatcher(opts) {
3060
- const absRoots = opts.roots.map((r) => resolve11(opts.cwd, r));
3115
+ const absRoots = opts.roots.map((r) => resolve12(opts.cwd, r));
3061
3116
  const ignoreFilterOpt = opts.ignoreFilter;
3062
3117
  const getFilter = ignoreFilterOpt === void 0 ? void 0 : typeof ignoreFilterOpt === "function" ? ignoreFilterOpt : () => ignoreFilterOpt;
3063
3118
  const ignored = getFilter ? (path) => {