skillwiki 0.10.4 → 0.10.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.
|
@@ -6999,6 +6999,61 @@ ${input.text.trim()}
|
|
|
6999
6999
|
import { createHash as createHash7 } from "crypto";
|
|
7000
7000
|
import { mkdir as mkdir6, readFile as readFile16, readdir as readdir4, stat as stat5, writeFile as writeFile5 } from "fs/promises";
|
|
7001
7001
|
import { basename as basename2, extname, join as join26, relative as relative3, sep as sep3 } from "path";
|
|
7002
|
+
|
|
7003
|
+
// src/utils/memory-authority.ts
|
|
7004
|
+
var TIER_RANK = {
|
|
7005
|
+
"accepted-decision": 0,
|
|
7006
|
+
"operational-guidance": 1,
|
|
7007
|
+
proposed: 2,
|
|
7008
|
+
exploratory: 3,
|
|
7009
|
+
unclassified: 4
|
|
7010
|
+
};
|
|
7011
|
+
function memoryAuthorityTiersRank(tier) {
|
|
7012
|
+
if (!tier) return TIER_RANK.unclassified;
|
|
7013
|
+
const key = String(tier).toLowerCase();
|
|
7014
|
+
return TIER_RANK[key] ?? TIER_RANK.unclassified;
|
|
7015
|
+
}
|
|
7016
|
+
function classifyMemoryAuthority(source) {
|
|
7017
|
+
const kind = (source.memory_kind ?? "").toLowerCase();
|
|
7018
|
+
const policy = (source.memory_policy ?? "").toLowerCase();
|
|
7019
|
+
const status = (source.memory_status ?? "").toLowerCase();
|
|
7020
|
+
if (kind === "decision-context" && policy === "operational" && status === "active") {
|
|
7021
|
+
return "accepted-decision";
|
|
7022
|
+
}
|
|
7023
|
+
if (policy === "operational" && status === "active") {
|
|
7024
|
+
return "operational-guidance";
|
|
7025
|
+
}
|
|
7026
|
+
if (["proposed", "draft", "pending"].includes(status) || ["proposed", "hypothesis", "research"].includes(policy)) {
|
|
7027
|
+
return "proposed";
|
|
7028
|
+
}
|
|
7029
|
+
if (policy === "exploratory") {
|
|
7030
|
+
return "exploratory";
|
|
7031
|
+
}
|
|
7032
|
+
return "unclassified";
|
|
7033
|
+
}
|
|
7034
|
+
function isProjectLocal(source, project) {
|
|
7035
|
+
if (!project) return false;
|
|
7036
|
+
if (typeof source.path === "string" && source.path.startsWith(`projects/${project}/`)) {
|
|
7037
|
+
return true;
|
|
7038
|
+
}
|
|
7039
|
+
const scope = (source.memory_scope || "project").toLowerCase();
|
|
7040
|
+
if (scope !== "project") return false;
|
|
7041
|
+
return !source.project || source.project === project;
|
|
7042
|
+
}
|
|
7043
|
+
function compareMemoryAuthority(a, b, options = {}) {
|
|
7044
|
+
const tierDiff = memoryAuthorityTiersRank(classifyMemoryAuthority(a)) - memoryAuthorityTiersRank(classifyMemoryAuthority(b));
|
|
7045
|
+
if (tierDiff !== 0) return tierDiff;
|
|
7046
|
+
if (options.preferProjectWithinTiers && options.project) {
|
|
7047
|
+
const aLocal = Number(isProjectLocal(a, options.project));
|
|
7048
|
+
const bLocal = Number(isProjectLocal(b, options.project));
|
|
7049
|
+
if (aLocal !== bLocal) return bLocal - aLocal;
|
|
7050
|
+
}
|
|
7051
|
+
const updatedDiff = b.updated.localeCompare(a.updated);
|
|
7052
|
+
if (updatedDiff !== 0) return updatedDiff;
|
|
7053
|
+
return a.path.localeCompare(b.path);
|
|
7054
|
+
}
|
|
7055
|
+
|
|
7056
|
+
// src/commands/memory.ts
|
|
7002
7057
|
async function runMemoryTopics(input) {
|
|
7003
7058
|
const scan = await scanVault(input.vault);
|
|
7004
7059
|
if (!scan.ok) return { exitCode: ExitCode.VAULT_PATH_INVALID, result: scan };
|
|
@@ -7825,12 +7880,16 @@ function normalizeTopics(value) {
|
|
|
7825
7880
|
const paths = stringArray(item.paths);
|
|
7826
7881
|
if (!name || !summary || !updated || paths.length === 0) continue;
|
|
7827
7882
|
const project = stringField(item.project);
|
|
7883
|
+
const authority_tier = stringField(item.authority_tier);
|
|
7884
|
+
const lead_path = stringField(item.lead_path);
|
|
7828
7885
|
topics.push({
|
|
7829
7886
|
name,
|
|
7830
7887
|
summary,
|
|
7831
7888
|
...project ? { project } : {},
|
|
7832
7889
|
updated,
|
|
7833
|
-
paths
|
|
7890
|
+
paths,
|
|
7891
|
+
...authority_tier ? { authority_tier } : {},
|
|
7892
|
+
...lead_path ? { lead_path } : {}
|
|
7834
7893
|
});
|
|
7835
7894
|
}
|
|
7836
7895
|
return topics;
|
|
@@ -7870,10 +7929,14 @@ function normalizeLimit(value) {
|
|
|
7870
7929
|
return Math.floor(value);
|
|
7871
7930
|
}
|
|
7872
7931
|
function compareTopics(a, b) {
|
|
7932
|
+
if (a.authority_tier || b.authority_tier) {
|
|
7933
|
+
const tr = memoryAuthorityTiersRank(a.authority_tier) - memoryAuthorityTiersRank(b.authority_tier);
|
|
7934
|
+
if (tr !== 0) return tr;
|
|
7935
|
+
}
|
|
7873
7936
|
return b.updated.localeCompare(a.updated) || a.name.localeCompare(b.name);
|
|
7874
7937
|
}
|
|
7875
7938
|
function compareSources(a, b) {
|
|
7876
|
-
return
|
|
7939
|
+
return compareMemoryAuthority(a, b);
|
|
7877
7940
|
}
|
|
7878
7941
|
function normalizeRecallScope(value) {
|
|
7879
7942
|
if (!value) return void 0;
|
|
@@ -7891,8 +7954,13 @@ function recallScopeMatches(source, project, scope) {
|
|
|
7891
7954
|
return source.memory_scope === scope;
|
|
7892
7955
|
}
|
|
7893
7956
|
function compareRecallSources(a, b, project, scope) {
|
|
7894
|
-
if (scope
|
|
7895
|
-
|
|
7957
|
+
if (scope === "all") {
|
|
7958
|
+
return compareMemoryAuthority(a, b, {
|
|
7959
|
+
project,
|
|
7960
|
+
preferProjectWithinTiers: true
|
|
7961
|
+
});
|
|
7962
|
+
}
|
|
7963
|
+
return compareSources(a, b);
|
|
7896
7964
|
}
|
|
7897
7965
|
function isProjectMemorySource(source, project) {
|
|
7898
7966
|
const scope = source.memory_scope || "project";
|
|
@@ -7972,12 +8040,17 @@ function buildTopics(project, sources) {
|
|
|
7972
8040
|
}
|
|
7973
8041
|
return [...byTopic.entries()].map(([name, topicSources]) => {
|
|
7974
8042
|
const sorted = [...topicSources].sort(compareSources);
|
|
8043
|
+
const lead = sorted[0];
|
|
7975
8044
|
return {
|
|
7976
8045
|
name,
|
|
7977
8046
|
project,
|
|
7978
|
-
summary:
|
|
7979
|
-
updated:
|
|
7980
|
-
paths: sorted.map((source) => source.path)
|
|
8047
|
+
summary: lead?.summary ?? "",
|
|
8048
|
+
updated: lead?.updated ?? "",
|
|
8049
|
+
paths: sorted.map((source) => source.path),
|
|
8050
|
+
...lead ? {
|
|
8051
|
+
authority_tier: classifyMemoryAuthority(lead),
|
|
8052
|
+
lead_path: lead.path
|
|
8053
|
+
} : {}
|
|
7981
8054
|
};
|
|
7982
8055
|
}).sort((a, b) => a.name.localeCompare(b.name));
|
|
7983
8056
|
}
|
|
@@ -9213,6 +9286,7 @@ export {
|
|
|
9213
9286
|
runDoctor,
|
|
9214
9287
|
readCliPackageJson,
|
|
9215
9288
|
runObserve,
|
|
9289
|
+
memoryAuthorityTiersRank,
|
|
9216
9290
|
runMemoryTopics,
|
|
9217
9291
|
runMemoryIndex,
|
|
9218
9292
|
runMemoryRecall,
|
package/dist/cli.js
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
getSessionId,
|
|
19
19
|
isFailedRunStatus,
|
|
20
20
|
isValidRemoteDeleteCap,
|
|
21
|
+
memoryAuthorityTiersRank,
|
|
21
22
|
mergeTaxonomyConflict,
|
|
22
23
|
normalizeRemoteRoot,
|
|
23
24
|
planAndMaybePruneRemoteObjects,
|
|
@@ -68,7 +69,7 @@ import {
|
|
|
68
69
|
satelliteLatestRunPath,
|
|
69
70
|
taxonomyCommentForPage,
|
|
70
71
|
upsertIndexEntry
|
|
71
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-NJFCTMYZ.js";
|
|
72
73
|
import {
|
|
73
74
|
normalizeDistTag,
|
|
74
75
|
readCache,
|
|
@@ -3909,13 +3910,21 @@ async function loadMemoryTopics(vault, project) {
|
|
|
3909
3910
|
try {
|
|
3910
3911
|
const parsed = JSON.parse(text);
|
|
3911
3912
|
if (!Array.isArray(parsed.topics)) return [];
|
|
3912
|
-
return parsed.topics.filter((topic) => typeof topic === "object" && topic !== null && !Array.isArray(topic)).map((topic) =>
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3913
|
+
return parsed.topics.filter((topic) => typeof topic === "object" && topic !== null && !Array.isArray(topic)).map((topic) => {
|
|
3914
|
+
const authority_tier = stringField(topic.authority_tier);
|
|
3915
|
+
const lead_path = stringField(topic.lead_path);
|
|
3916
|
+
return {
|
|
3917
|
+
name: stringField(topic.name),
|
|
3918
|
+
summary: stringField(topic.summary),
|
|
3919
|
+
project: stringField(topic.project) || void 0,
|
|
3920
|
+
updated: stringField(topic.updated),
|
|
3921
|
+
paths: Array.isArray(topic.paths) ? topic.paths.filter((path) => typeof path === "string") : [],
|
|
3922
|
+
...authority_tier ? { authority_tier } : {},
|
|
3923
|
+
...lead_path ? { lead_path } : {}
|
|
3924
|
+
};
|
|
3925
|
+
}).filter((topic) => topic.name && topic.summary && topic.updated && topic.paths.length > 0).sort(
|
|
3926
|
+
(a, b) => memoryAuthorityTiersRank(a.authority_tier) - memoryAuthorityTiersRank(b.authority_tier) || b.updated.localeCompare(a.updated) || a.name.localeCompare(b.name)
|
|
3927
|
+
).slice(0, 5);
|
|
3919
3928
|
} catch {
|
|
3920
3929
|
return [];
|
|
3921
3930
|
}
|
package/dist/skillwiki-mcp.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skillwiki",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.5",
|
|
4
4
|
"skills": "./",
|
|
5
5
|
"description": "Project-aware Karpathy-style knowledge base for Claude Code: 19 prompt-only skills (wiki-*, proj-*, using-skillwiki) backed by the deterministic `skillwiki` CLI.",
|
|
6
6
|
"author": {
|