@skill-map/cli 0.34.1 → 0.35.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/cli.js +194 -41
- package/dist/cli.js.map +1 -1
- package/dist/index.js +107 -32
- package/dist/index.js.map +1 -1
- package/dist/kernel/index.d.ts +67 -0
- package/dist/kernel/index.js +107 -32
- package/dist/kernel/index.js.map +1 -1
- package/dist/ui/{chunk-K3VXQ5PI.js → chunk-P25ABCQU.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/dist/ui/{main-OQDTVVQA.js → main-MNZ7YAUE.js} +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -101,7 +101,7 @@ import cl100k_base from "js-tiktoken/ranks/cl100k_base";
|
|
|
101
101
|
// package.json
|
|
102
102
|
var package_default = {
|
|
103
103
|
name: "@skill-map/cli",
|
|
104
|
-
version: "0.
|
|
104
|
+
version: "0.35.0",
|
|
105
105
|
description: "skill-map reference implementation \u2014 kernel + CLI + adapters.",
|
|
106
106
|
license: "MIT",
|
|
107
107
|
type: "module",
|
|
@@ -1713,6 +1713,9 @@ function classifyLinkSource(source, shortIdToQualified, cachedQualifiedIds, appl
|
|
|
1713
1713
|
return "obsolete";
|
|
1714
1714
|
}
|
|
1715
1715
|
|
|
1716
|
+
// kernel/orchestrator/lift-resolved-link-confidence.ts
|
|
1717
|
+
import { posix as pathPosix } from "path";
|
|
1718
|
+
|
|
1716
1719
|
// kernel/trigger-normalize.ts
|
|
1717
1720
|
function normalizeTrigger(source) {
|
|
1718
1721
|
let out = source.normalize("NFD");
|
|
@@ -1723,37 +1726,92 @@ function normalizeTrigger(source) {
|
|
|
1723
1726
|
return out.trim();
|
|
1724
1727
|
}
|
|
1725
1728
|
|
|
1726
|
-
// kernel/orchestrator/lift-
|
|
1727
|
-
function
|
|
1728
|
-
if (!links.some((l) => l.
|
|
1729
|
-
const
|
|
1730
|
-
for (const node of nodes) byPath2.add(node.path);
|
|
1731
|
-
const byNormalizedName = indexByNormalizedName(nodes);
|
|
1729
|
+
// kernel/orchestrator/lift-resolved-link-confidence.ts
|
|
1730
|
+
function liftResolvedLinkConfidence(links, nodes, ctx) {
|
|
1731
|
+
if (!links.some((l) => l.confidence < 1)) return;
|
|
1732
|
+
const indexes = buildIndexes(nodes, ctx);
|
|
1732
1733
|
for (const link of links) {
|
|
1733
|
-
if (link.
|
|
1734
|
-
if (isResolved(link, byPath2, byNormalizedName)) {
|
|
1734
|
+
if (link.confidence < 1 && resolves(link, indexes, ctx)) {
|
|
1735
1735
|
link.confidence = 1;
|
|
1736
1736
|
}
|
|
1737
1737
|
}
|
|
1738
1738
|
}
|
|
1739
|
-
function
|
|
1740
|
-
const
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
if (byNormalizedName.has(withoutSigil)) return true;
|
|
1744
|
-
}
|
|
1745
|
-
if (byPath2.has(link.target)) return true;
|
|
1746
|
-
return false;
|
|
1747
|
-
}
|
|
1748
|
-
function indexByNormalizedName(nodes) {
|
|
1749
|
-
const out = /* @__PURE__ */ new Map();
|
|
1739
|
+
function buildIndexes(nodes, ctx) {
|
|
1740
|
+
const byPath2 = /* @__PURE__ */ new Set();
|
|
1741
|
+
const byName = /* @__PURE__ */ new Map();
|
|
1742
|
+
const nodeByPath = /* @__PURE__ */ new Map();
|
|
1750
1743
|
for (const node of nodes) {
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1744
|
+
byPath2.add(node.path);
|
|
1745
|
+
nodeByPath.set(node.path, node);
|
|
1746
|
+
indexNode(node, ctx, byName);
|
|
1747
|
+
}
|
|
1748
|
+
return { byPath: byPath2, byName, nodeByPath };
|
|
1749
|
+
}
|
|
1750
|
+
function resolves(link, indexes, ctx) {
|
|
1751
|
+
if (indexes.byPath.has(link.target)) return true;
|
|
1752
|
+
return resolvesByName(link, indexes, ctx);
|
|
1753
|
+
}
|
|
1754
|
+
function resolvesByName(link, indexes, ctx) {
|
|
1755
|
+
const stripped = stripTriggerSigil(link.trigger?.normalizedTrigger);
|
|
1756
|
+
if (stripped === null) return false;
|
|
1757
|
+
const candidates = indexes.byName.get(stripped);
|
|
1758
|
+
if (!candidates?.length) return false;
|
|
1759
|
+
const allowedKinds = lookupAllowedKinds(link, indexes, ctx);
|
|
1760
|
+
if (!allowedKinds?.length) return false;
|
|
1761
|
+
return candidates.some((c) => allowedKinds.includes(c.kind));
|
|
1762
|
+
}
|
|
1763
|
+
function lookupAllowedKinds(link, indexes, ctx) {
|
|
1764
|
+
const sourceNode = indexes.nodeByPath.get(link.source);
|
|
1765
|
+
if (!sourceNode) return void 0;
|
|
1766
|
+
return ctx.providerResolution.get(sourceNode.provider)?.[link.kind];
|
|
1767
|
+
}
|
|
1768
|
+
function stripTriggerSigil(normalized) {
|
|
1769
|
+
if (!normalized) return null;
|
|
1770
|
+
const trimmed = normalized.replace(/^[/@]/, "").trim();
|
|
1771
|
+
return trimmed.length === 0 ? null : trimmed;
|
|
1772
|
+
}
|
|
1773
|
+
function indexNode(node, ctx, byName) {
|
|
1774
|
+
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);
|
|
1783
|
+
if (bucket) {
|
|
1784
|
+
bucket.push({ kind: node.kind });
|
|
1785
|
+
} else {
|
|
1786
|
+
byName.set(normalized, [{ kind: node.kind }]);
|
|
1787
|
+
}
|
|
1755
1788
|
}
|
|
1756
|
-
|
|
1789
|
+
}
|
|
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
|
+
function kindKey(node) {
|
|
1814
|
+
return `${node.provider}/${node.kind}`;
|
|
1757
1815
|
}
|
|
1758
1816
|
|
|
1759
1817
|
// kernel/orchestrator/post-walk-transforms.ts
|
|
@@ -1766,17 +1824,17 @@ var POST_WALK_TRANSFORMS = [
|
|
|
1766
1824
|
}
|
|
1767
1825
|
},
|
|
1768
1826
|
{
|
|
1769
|
-
id: "lift-
|
|
1770
|
-
description: "Bump
|
|
1771
|
-
run(links, nodes) {
|
|
1772
|
-
|
|
1827
|
+
id: "lift-resolved-link-confidence",
|
|
1828
|
+
description: "Bump invocation links to confidence 1.0 when target / trigger resolves against the full node graph per the source Provider rules.",
|
|
1829
|
+
run(links, nodes, ctx) {
|
|
1830
|
+
liftResolvedLinkConfidence(links, nodes, ctx);
|
|
1773
1831
|
}
|
|
1774
1832
|
}
|
|
1775
1833
|
];
|
|
1776
|
-
function applyPostWalkTransforms(links, nodes, transforms = POST_WALK_TRANSFORMS) {
|
|
1834
|
+
function applyPostWalkTransforms(links, nodes, ctx, transforms = POST_WALK_TRANSFORMS) {
|
|
1777
1835
|
let current = links;
|
|
1778
1836
|
for (const transform of transforms) {
|
|
1779
|
-
const next = transform.run(current, nodes);
|
|
1837
|
+
const next = transform.run(current, nodes, ctx);
|
|
1780
1838
|
if (next) current = next;
|
|
1781
1839
|
}
|
|
1782
1840
|
return current;
|
|
@@ -2846,7 +2904,8 @@ async function runScanInternal(_kernel, options) {
|
|
|
2846
2904
|
pluginStores: options.pluginStores,
|
|
2847
2905
|
activeProvider: resolveActiveProviderOption(options.activeProvider, options.roots)
|
|
2848
2906
|
});
|
|
2849
|
-
|
|
2907
|
+
const postWalkCtx = buildPostWalkTransformCtx(_kernel);
|
|
2908
|
+
walked.internalLinks = applyPostWalkTransforms(walked.internalLinks, walked.nodes, postWalkCtx);
|
|
2850
2909
|
recomputeLinkCounts(walked.nodes, walked.internalLinks);
|
|
2851
2910
|
recomputeExternalRefsCount(walked.nodes, walked.externalLinks, walked.cachedPaths);
|
|
2852
2911
|
await dispatchExtractorCompleted(exts.extractors, emitter, hookDispatcher);
|
|
@@ -2879,6 +2938,22 @@ async function runScanInternal(_kernel, options) {
|
|
|
2879
2938
|
await hookDispatcher.dispatch("scan.completed", scanCompletedEvent);
|
|
2880
2939
|
return buildScanReturn(walked, issues, renameOps, stats, options, setup);
|
|
2881
2940
|
}
|
|
2941
|
+
function buildPostWalkTransformCtx(kernel) {
|
|
2942
|
+
const kindRegistry = /* @__PURE__ */ new Map();
|
|
2943
|
+
const providerResolution = /* @__PURE__ */ new Map();
|
|
2944
|
+
const providers = kernel.registry.all("provider");
|
|
2945
|
+
for (const provider of providers) {
|
|
2946
|
+
if (provider.kinds) {
|
|
2947
|
+
for (const [kindName, descriptor] of Object.entries(provider.kinds)) {
|
|
2948
|
+
kindRegistry.set(`${provider.id}/${kindName}`, descriptor);
|
|
2949
|
+
}
|
|
2950
|
+
}
|
|
2951
|
+
if (provider.resolution) {
|
|
2952
|
+
providerResolution.set(provider.id, provider.resolution);
|
|
2953
|
+
}
|
|
2954
|
+
}
|
|
2955
|
+
return { kindRegistry, providerResolution };
|
|
2956
|
+
}
|
|
2882
2957
|
function buildScanSetup(options) {
|
|
2883
2958
|
const start = Date.now();
|
|
2884
2959
|
const emitter = options.emitter ?? new InMemoryProgressEmitter();
|