skillwiki 0.10.111 → 0.10.113
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/{chunk-I6IRJCUJ.js → chunk-3TKNAOJH.js} +2 -2
- package/dist/chunk-5D5HFQ76.js +111 -0
- package/dist/{chunk-OJJBZDPR.js → chunk-5RHR4FEK.js} +183 -211
- package/dist/{chunk-GQWCTJTU.js → chunk-6VUK2FTX.js} +1 -1
- package/dist/{chunk-JQV5KNPT.js → chunk-CBT35FAW.js} +3 -3
- package/dist/{chunk-HBJLFPQP.js → chunk-FQERKMD7.js} +458 -18
- package/dist/{chunk-PYPPG7RF.js → chunk-IJKJGQKL.js} +1 -1
- package/dist/{chunk-MRPJ7X7W.js → chunk-IJWZDQDH.js} +3 -3
- package/dist/{chunk-X5GL2FCU.js → chunk-JL2SCLXT.js} +1 -1
- package/dist/chunk-K3M6OSUW.js +77 -0
- package/dist/{chunk-5IBLXGLY.js → chunk-K3YZESND.js} +2 -2
- package/dist/chunk-OGEAFXON.js +60 -0
- package/dist/{chunk-6OQLBNKR.js → chunk-OWWWO2XS.js} +29 -4
- package/dist/{chunk-KWEYA3OE.js → chunk-SEY4N4CT.js} +1 -1
- package/dist/{chunk-UIEQIJXP.js → chunk-VNSZCK5V.js} +47 -44
- package/dist/{chunk-TDBUJUYH.js → chunk-XJ5VEIH7.js} +42 -18
- package/dist/cli.js +586 -122
- package/dist/{index-projection-2K672CBO.js → index-projection-RQSOEDXM.js} +5 -5
- package/dist/{journal-QU5IDXQF.js → journal-V5XHBEI5.js} +3 -3
- package/dist/{managed-write-preflight-GRSHQYKC.js → managed-write-preflight-2BMHZWVJ.js} +7 -7
- package/dist/mcp-auth-env-QONKW4EO.js +25 -0
- package/dist/{migrate-PIB4QA54.js → migrate-SRRCXI2K.js} +6 -5
- package/dist/mirror-H5BTBAON.js +151 -0
- package/dist/runtime-LQZIG3XN.js +20 -0
- package/dist/skillwiki-mcp.js +14 -12
- package/dist/sources-E6KHDRDE.js +10 -0
- package/dist/{watcher-MHG46J3R.js → watcher-VJ3TOU6J.js} +20 -110
- package/package.json +1 -1
- package/skills/.claude-plugin/plugin.json +1 -1
- package/skills/.codex-plugin/plugin.json +1 -1
- package/skills/.cursor-plugin/plugin.json +1 -1
- package/skills/package.json +1 -1
- package/skills/skills/using-skillwiki/SKILL.md +1 -1
- package/skills/skills/wiki-ingest/SKILL.md +47 -0
- package/skills/skills/wiki-init/SKILL.md +3 -0
- package/skills/skills/wiki-lint/SKILL.md +7 -0
- package/skills/using-skillwiki/SKILL.md +1 -1
- package/skills/wiki-ingest/SKILL.md +47 -0
- package/skills/wiki-init/SKILL.md +3 -0
- package/skills/wiki-lint/SKILL.md +7 -0
- package/templates/launchd/com.karlchow.skillwiki-mirror-sse.plist +20 -0
- package/dist/chunk-I2J3IJB7.js +0 -54
- package/dist/runtime-GLMI5OCT.js +0 -15
- package/dist/sources-D2MGP246.js +0 -10
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
planSourceCompileRelease,
|
|
12
12
|
planSourceReview,
|
|
13
13
|
runSourcesPending
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-CBT35FAW.js";
|
|
15
15
|
import {
|
|
16
16
|
latestFromCache,
|
|
17
17
|
semverGt
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
import {
|
|
20
20
|
renderRootIndex,
|
|
21
21
|
writeRootIndexProjection
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-IJWZDQDH.js";
|
|
23
23
|
import {
|
|
24
24
|
VAULT_HYGIENE_GENERATED_COMMIT_PATHS,
|
|
25
25
|
VAULT_HYGIENE_GITIGNORE_PATTERNS,
|
|
@@ -48,14 +48,14 @@ import {
|
|
|
48
48
|
satelliteGateFromFleetLoad,
|
|
49
49
|
snapshotterAliasForLocalHost,
|
|
50
50
|
toUndirectedWeighted
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-FQERKMD7.js";
|
|
52
52
|
import {
|
|
53
53
|
eventPathFor,
|
|
54
54
|
writeLogEvent
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-K3YZESND.js";
|
|
56
56
|
import {
|
|
57
57
|
prepareTypedPage
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-3TKNAOJH.js";
|
|
59
59
|
import {
|
|
60
60
|
extractFrontmatter,
|
|
61
61
|
readPage,
|
|
@@ -64,18 +64,28 @@ import {
|
|
|
64
64
|
scanSensitiveContent,
|
|
65
65
|
scanVault,
|
|
66
66
|
splitFrontmatter
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-JL2SCLXT.js";
|
|
68
|
+
import {
|
|
69
|
+
isMcpOnlyLeaf,
|
|
70
|
+
mcpAuthFromEnv,
|
|
71
|
+
mergeMcpAuthIntoEnv,
|
|
72
|
+
redactMcpSecret
|
|
73
|
+
} from "./chunk-OGEAFXON.js";
|
|
68
74
|
import {
|
|
69
75
|
xml
|
|
70
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-XJ5VEIH7.js";
|
|
77
|
+
import {
|
|
78
|
+
atomicWriteText
|
|
79
|
+
} from "./chunk-6VUK2FTX.js";
|
|
71
80
|
import {
|
|
72
81
|
CLIP_NOT_CONFIGURED,
|
|
82
|
+
PRODUCTION_MIRROR_LABEL,
|
|
73
83
|
PRODUCTION_WATCHER_LABEL,
|
|
74
84
|
RETIRED_WATCHER_LABELS,
|
|
75
85
|
conditionalCreateProven,
|
|
76
86
|
loadClipCredentials,
|
|
77
87
|
loadClipOutboxConfig
|
|
78
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-OWWWO2XS.js";
|
|
79
89
|
import {
|
|
80
90
|
CONFIG_KEYS,
|
|
81
91
|
isValidWikiProfileKey,
|
|
@@ -83,10 +93,7 @@ import {
|
|
|
83
93
|
parseDotenvText,
|
|
84
94
|
resolveSkillwikiHome,
|
|
85
95
|
writeDotenv
|
|
86
|
-
} from "./chunk-
|
|
87
|
-
import {
|
|
88
|
-
atomicWriteText
|
|
89
|
-
} from "./chunk-GQWCTJTU.js";
|
|
96
|
+
} from "./chunk-IJKJGQKL.js";
|
|
90
97
|
import {
|
|
91
98
|
CompoundSchema,
|
|
92
99
|
ExitCode,
|
|
@@ -102,7 +109,7 @@ import {
|
|
|
102
109
|
parseClipOutboxKeyValue,
|
|
103
110
|
parseVaultSyncKeyValue,
|
|
104
111
|
systemdPropertyFor
|
|
105
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-VNSZCK5V.js";
|
|
106
113
|
|
|
107
114
|
// src/commands/log-append.ts
|
|
108
115
|
import { readFile, stat } from "fs/promises";
|
|
@@ -1111,66 +1118,23 @@ async function runConfigPath(input) {
|
|
|
1111
1118
|
return { exitCode: ExitCode.OK, result: ok({ path: filePath, exists: existsSync2(filePath), humanHint: filePath }) };
|
|
1112
1119
|
}
|
|
1113
1120
|
|
|
1114
|
-
// src/utils/mcp-auth-env.ts
|
|
1115
|
-
import { join as join6 } from "path";
|
|
1116
|
-
var MCP_URL_ENV = "SKILLWIKI_MCP_URL";
|
|
1117
|
-
var MCP_TOKEN_ENV = "SKILLWIKI_MCP_TOKEN";
|
|
1118
|
-
var MCP_HOST_ID_ENV = "SKILLWIKI_HOST_ID";
|
|
1119
|
-
function nonEmptyEnvValue(value) {
|
|
1120
|
-
if (typeof value !== "string") return void 0;
|
|
1121
|
-
const trimmed = value.trim();
|
|
1122
|
-
return trimmed.length > 0 ? trimmed : void 0;
|
|
1123
|
-
}
|
|
1124
|
-
function mcpAuthFromEnv(env) {
|
|
1125
|
-
return {
|
|
1126
|
-
url: nonEmptyEnvValue(env[MCP_URL_ENV]),
|
|
1127
|
-
token: nonEmptyEnvValue(env[MCP_TOKEN_ENV]),
|
|
1128
|
-
hostId: nonEmptyEnvValue(env[MCP_HOST_ID_ENV])
|
|
1129
|
-
};
|
|
1130
|
-
}
|
|
1131
|
-
async function resolveMcpAuthEnv(input) {
|
|
1132
|
-
const processAuth = mcpAuthFromEnv(input.env ?? process.env);
|
|
1133
|
-
const dotenv = await parseDotenvFile(join6(resolveSkillwikiHome(input.home, input.env), ".skillwiki", ".env"));
|
|
1134
|
-
const fileAuth = mcpAuthFromEnv(dotenv);
|
|
1135
|
-
return {
|
|
1136
|
-
url: processAuth.url ?? fileAuth.url,
|
|
1137
|
-
token: processAuth.token ?? fileAuth.token,
|
|
1138
|
-
hostId: processAuth.hostId ?? fileAuth.hostId
|
|
1139
|
-
};
|
|
1140
|
-
}
|
|
1141
|
-
async function mergeMcpAuthIntoEnv(home, env) {
|
|
1142
|
-
const auth = await resolveMcpAuthEnv({ home, env });
|
|
1143
|
-
const merged = { ...env };
|
|
1144
|
-
if (auth.url && !nonEmptyEnvValue(env[MCP_URL_ENV])) merged[MCP_URL_ENV] = auth.url;
|
|
1145
|
-
if (auth.token && !nonEmptyEnvValue(env[MCP_TOKEN_ENV])) merged[MCP_TOKEN_ENV] = auth.token;
|
|
1146
|
-
if (auth.hostId && !nonEmptyEnvValue(env[MCP_HOST_ID_ENV])) merged[MCP_HOST_ID_ENV] = auth.hostId;
|
|
1147
|
-
return merged;
|
|
1148
|
-
}
|
|
1149
|
-
function redactMcpSecret(text, secret) {
|
|
1150
|
-
if (!secret || secret.length === 0 || !text.includes(secret)) return text;
|
|
1151
|
-
return text.split(secret).join("[REDACTED]");
|
|
1152
|
-
}
|
|
1153
|
-
function isMcpOnlyLeaf(input) {
|
|
1154
|
-
return !input.resolvedPath && Boolean(input.token) && !input.vaultSyncInstalled;
|
|
1155
|
-
}
|
|
1156
|
-
|
|
1157
1121
|
// src/doctor/runner.ts
|
|
1158
1122
|
import { existsSync as existsSync19 } from "fs";
|
|
1159
1123
|
|
|
1160
1124
|
// src/doctor/probes/environment.ts
|
|
1161
1125
|
import { existsSync as existsSync4, lstatSync, readlinkSync } from "fs";
|
|
1162
|
-
import { resolve as resolve2, join as
|
|
1126
|
+
import { resolve as resolve2, join as join7 } from "path";
|
|
1163
1127
|
import { execSync } from "child_process";
|
|
1164
1128
|
|
|
1165
1129
|
// src/utils/plugin-registry.ts
|
|
1166
1130
|
import { existsSync as existsSync3, readdirSync, readFileSync as readFileSync2 } from "fs";
|
|
1167
|
-
import { join as
|
|
1168
|
-
var REGISTRY_PATH =
|
|
1169
|
-
var CODEX_CONFIG_PATH =
|
|
1131
|
+
import { join as join6 } from "path";
|
|
1132
|
+
var REGISTRY_PATH = join6(".claude", "plugins", "installed_plugins.json");
|
|
1133
|
+
var CODEX_CONFIG_PATH = join6(".codex", "config.toml");
|
|
1170
1134
|
var PLUGIN_KEY = "skillwiki@llm-wiki";
|
|
1171
1135
|
function readInstalledPlugins(home) {
|
|
1172
1136
|
try {
|
|
1173
|
-
const raw = readFileSync2(
|
|
1137
|
+
const raw = readFileSync2(join6(home, REGISTRY_PATH), "utf8");
|
|
1174
1138
|
return JSON.parse(raw);
|
|
1175
1139
|
} catch {
|
|
1176
1140
|
return null;
|
|
@@ -1206,7 +1170,7 @@ function findPluginInstallations(home, key = PLUGIN_KEY) {
|
|
|
1206
1170
|
return installs;
|
|
1207
1171
|
}
|
|
1208
1172
|
function findGrokPlugin(home, key, pluginName, marketplace) {
|
|
1209
|
-
const pluginsRoot =
|
|
1173
|
+
const pluginsRoot = join6(home, ".grok", "installed-plugins");
|
|
1210
1174
|
if (!existsSync3(pluginsRoot)) return null;
|
|
1211
1175
|
let entries;
|
|
1212
1176
|
try {
|
|
@@ -1217,10 +1181,10 @@ function findGrokPlugin(home, key, pluginName, marketplace) {
|
|
|
1217
1181
|
let best = null;
|
|
1218
1182
|
for (const entry of entries) {
|
|
1219
1183
|
if (!entry.isDirectory()) continue;
|
|
1220
|
-
const installPath =
|
|
1184
|
+
const installPath = join6(pluginsRoot, entry.name);
|
|
1221
1185
|
let manifest;
|
|
1222
1186
|
try {
|
|
1223
|
-
manifest = JSON.parse(readFileSync2(
|
|
1187
|
+
manifest = JSON.parse(readFileSync2(join6(installPath, ".claude-plugin", "plugin.json"), "utf8"));
|
|
1224
1188
|
} catch {
|
|
1225
1189
|
continue;
|
|
1226
1190
|
}
|
|
@@ -1244,7 +1208,7 @@ function findGrokPlugin(home, key, pluginName, marketplace) {
|
|
|
1244
1208
|
function findCodexPlugin(home, key, pluginName, marketplace) {
|
|
1245
1209
|
const config = readCodexPluginConfig(home, key, marketplace);
|
|
1246
1210
|
if (!config?.enabled) return null;
|
|
1247
|
-
const cacheRoot =
|
|
1211
|
+
const cacheRoot = join6(home, ".codex", "plugins", "cache", marketplace, pluginName);
|
|
1248
1212
|
if (!existsSync3(cacheRoot)) return null;
|
|
1249
1213
|
let versions;
|
|
1250
1214
|
try {
|
|
@@ -1260,7 +1224,7 @@ function findCodexPlugin(home, key, pluginName, marketplace) {
|
|
|
1260
1224
|
key,
|
|
1261
1225
|
pluginName,
|
|
1262
1226
|
marketplace,
|
|
1263
|
-
installPath:
|
|
1227
|
+
installPath: join6(cacheRoot, version),
|
|
1264
1228
|
version,
|
|
1265
1229
|
sourceType: config.sourceType,
|
|
1266
1230
|
source: config.source
|
|
@@ -1277,7 +1241,7 @@ function parsePluginKey(key) {
|
|
|
1277
1241
|
function readCodexPluginConfig(home, key, marketplace) {
|
|
1278
1242
|
let raw;
|
|
1279
1243
|
try {
|
|
1280
|
-
raw = readFileSync2(
|
|
1244
|
+
raw = readFileSync2(join6(home, CODEX_CONFIG_PATH), "utf8");
|
|
1281
1245
|
} catch {
|
|
1282
1246
|
return null;
|
|
1283
1247
|
}
|
|
@@ -1354,12 +1318,12 @@ function detectCliChannels(argv, home) {
|
|
|
1354
1318
|
}
|
|
1355
1319
|
const plugin = findPlugin(home);
|
|
1356
1320
|
if (plugin) {
|
|
1357
|
-
const pluginBin =
|
|
1321
|
+
const pluginBin = join7(plugin.installPath, "bin", "skillwiki");
|
|
1358
1322
|
if (existsSync4(pluginBin)) {
|
|
1359
1323
|
channels.push({ name: "plugin", path: pluginBin, isDevLink: false });
|
|
1360
1324
|
}
|
|
1361
1325
|
}
|
|
1362
|
-
const installBin =
|
|
1326
|
+
const installBin = join7(home, ".claude", "skills", "bin", "skillwiki");
|
|
1363
1327
|
if (existsSync4(installBin)) {
|
|
1364
1328
|
channels.push({ name: "install", path: installBin, isDevLink: false });
|
|
1365
1329
|
}
|
|
@@ -1451,7 +1415,7 @@ async function checkProfiles(home) {
|
|
|
1451
1415
|
}
|
|
1452
1416
|
async function checkProjectLocalOverride(cwd) {
|
|
1453
1417
|
const dir = cwd ?? process.cwd();
|
|
1454
|
-
const envPath =
|
|
1418
|
+
const envPath = join7(dir, ".skillwiki", ".env");
|
|
1455
1419
|
if (existsSync4(envPath)) {
|
|
1456
1420
|
return check("pass", "project_local", "Project-local config", `Found: ${envPath}`);
|
|
1457
1421
|
}
|
|
@@ -1487,7 +1451,7 @@ var environmentProbe = {
|
|
|
1487
1451
|
|
|
1488
1452
|
// src/doctor/probes/vault-structure.ts
|
|
1489
1453
|
import { existsSync as existsSync5, statSync as statSync2 } from "fs";
|
|
1490
|
-
import { join as
|
|
1454
|
+
import { join as join8 } from "path";
|
|
1491
1455
|
function checkWikiPathExists(resolvedPath, mcpOnlyLeaf) {
|
|
1492
1456
|
if (resolvedPath === void 0) {
|
|
1493
1457
|
return mcpOnlyOr(
|
|
@@ -1515,9 +1479,9 @@ function checkVaultStructure(resolvedPath, mcpOnlyLeaf) {
|
|
|
1515
1479
|
return check("error", "vault_structure", "Vault structure valid", "Cannot check \u2014 vault directory does not exist");
|
|
1516
1480
|
}
|
|
1517
1481
|
const missing = [];
|
|
1518
|
-
if (!existsSync5(
|
|
1482
|
+
if (!existsSync5(join8(resolvedPath, "SCHEMA.md"))) missing.push("SCHEMA.md");
|
|
1519
1483
|
for (const dir of ["raw", "entities", "concepts", "meta"]) {
|
|
1520
|
-
if (!existsSync5(
|
|
1484
|
+
if (!existsSync5(join8(resolvedPath, dir))) missing.push(dir + "/");
|
|
1521
1485
|
}
|
|
1522
1486
|
if (missing.length === 0) {
|
|
1523
1487
|
return check("pass", "vault_structure", "Vault structure valid", "All required files and directories present");
|
|
@@ -1534,9 +1498,9 @@ function checkObsidianTemplates(resolvedPath, mcpOnlyLeaf) {
|
|
|
1534
1498
|
);
|
|
1535
1499
|
}
|
|
1536
1500
|
const missing = [];
|
|
1537
|
-
if (!existsSync5(
|
|
1538
|
-
if (!existsSync5(
|
|
1539
|
-
if (!existsSync5(
|
|
1501
|
+
if (!existsSync5(join8(resolvedPath, "_Templates"))) missing.push("_Templates/");
|
|
1502
|
+
if (!existsSync5(join8(resolvedPath, ".obsidian", "templates.json"))) missing.push(".obsidian/templates.json");
|
|
1503
|
+
if (!existsSync5(join8(resolvedPath, ".obsidian", "app.json"))) missing.push(".obsidian/app.json");
|
|
1540
1504
|
if (missing.length === 0) {
|
|
1541
1505
|
return check("pass", "obsidian_templates", "Obsidian templates", "Template folder and config present");
|
|
1542
1506
|
}
|
|
@@ -1555,7 +1519,7 @@ var vaultStructureProbe = {
|
|
|
1555
1519
|
|
|
1556
1520
|
// src/doctor/probes/git-fleet.ts
|
|
1557
1521
|
import { existsSync as existsSync6, readFileSync as readFileSync3 } from "fs";
|
|
1558
|
-
import { join as
|
|
1522
|
+
import { join as join9 } from "path";
|
|
1559
1523
|
import { execSync as execSync2 } from "child_process";
|
|
1560
1524
|
import { platform } from "os";
|
|
1561
1525
|
function checkVaultGitRemote(resolvedPath, mcpOnlyLeaf = false) {
|
|
@@ -1567,7 +1531,7 @@ function checkVaultGitRemote(resolvedPath, mcpOnlyLeaf = false) {
|
|
|
1567
1531
|
check("error", "vault_git_remote", "Vault git remote", "Cannot check \u2014 WIKI_PATH not resolved")
|
|
1568
1532
|
);
|
|
1569
1533
|
}
|
|
1570
|
-
if (!existsSync6(
|
|
1534
|
+
if (!existsSync6(join9(resolvedPath, ".git"))) {
|
|
1571
1535
|
return check("warn", "vault_git_remote", "Vault git remote", "Vault is not a git repository \u2014 sync features unavailable");
|
|
1572
1536
|
}
|
|
1573
1537
|
try {
|
|
@@ -1615,7 +1579,7 @@ function checkSyncLastPush(resolvedPath, mcpOnlyLeaf = false) {
|
|
|
1615
1579
|
check("error", "sync_last_push", "Vault sync recency", "Cannot check \u2014 WIKI_PATH not resolved")
|
|
1616
1580
|
);
|
|
1617
1581
|
}
|
|
1618
|
-
if (!existsSync6(
|
|
1582
|
+
if (!existsSync6(join9(resolvedPath, ".git"))) {
|
|
1619
1583
|
return check("pass", "sync_last_push", "Vault sync recency", "No git repo \u2014 sync check skipped");
|
|
1620
1584
|
}
|
|
1621
1585
|
let timestamp;
|
|
@@ -1664,7 +1628,7 @@ function checkVaultGitDirty(resolvedPath) {
|
|
|
1664
1628
|
if (resolvedPath === void 0) {
|
|
1665
1629
|
return check("pass", "vault_git_dirty", "Vault git dirty state", "No vault path \u2014 check skipped");
|
|
1666
1630
|
}
|
|
1667
|
-
if (!existsSync6(
|
|
1631
|
+
if (!existsSync6(join9(resolvedPath, ".git"))) {
|
|
1668
1632
|
return check("pass", "vault_git_dirty", "Vault git dirty state", "No git repo \u2014 check skipped");
|
|
1669
1633
|
}
|
|
1670
1634
|
try {
|
|
@@ -1711,7 +1675,7 @@ function remoteMainHash(resolvedPath) {
|
|
|
1711
1675
|
}
|
|
1712
1676
|
function checkStaleRemoteMain(resolvedPath) {
|
|
1713
1677
|
if (resolvedPath === void 0) return void 0;
|
|
1714
|
-
if (!existsSync6(
|
|
1678
|
+
if (!existsSync6(join9(resolvedPath, ".git"))) return void 0;
|
|
1715
1679
|
const localOrigin = gitRefHash(resolvedPath, "origin/main");
|
|
1716
1680
|
if (!localOrigin) return void 0;
|
|
1717
1681
|
const remoteMain = remoteMainHash(resolvedPath);
|
|
@@ -1727,7 +1691,7 @@ function checkVaultGitComparison(resolvedPath, id, label, range, nonZeroSuffix,
|
|
|
1727
1691
|
if (resolvedPath === void 0) {
|
|
1728
1692
|
return check("pass", id, label, "No vault path \u2014 check skipped");
|
|
1729
1693
|
}
|
|
1730
|
-
if (!existsSync6(
|
|
1694
|
+
if (!existsSync6(join9(resolvedPath, ".git"))) {
|
|
1731
1695
|
return check("pass", id, label, "No git repo \u2014 check skipped");
|
|
1732
1696
|
}
|
|
1733
1697
|
if (!hasOriginMain(resolvedPath)) {
|
|
@@ -1772,11 +1736,11 @@ function checkVaultGitBehind(resolvedPath) {
|
|
|
1772
1736
|
}
|
|
1773
1737
|
function pullLogPaths(home) {
|
|
1774
1738
|
const paths = platform() === "darwin" ? [
|
|
1775
|
-
|
|
1776
|
-
|
|
1739
|
+
join9(home, "Library", "Logs", "wiki-pull.log"),
|
|
1740
|
+
join9(home, ".local", "state", "vault-sync", "log", "wiki-pull.log")
|
|
1777
1741
|
] : [
|
|
1778
|
-
|
|
1779
|
-
|
|
1742
|
+
join9(home, ".local", "state", "vault-sync", "log", "wiki-pull.log"),
|
|
1743
|
+
join9(home, "Library", "Logs", "wiki-pull.log")
|
|
1780
1744
|
];
|
|
1781
1745
|
return [...new Set(paths)];
|
|
1782
1746
|
}
|
|
@@ -1816,7 +1780,7 @@ function checkVaultLocalGit(resolvedPath, mcpOnlyLeaf = false) {
|
|
|
1816
1780
|
check("warn", "vault_local_git", "Vault local git", "Cannot check \u2014 WIKI_PATH not resolved")
|
|
1817
1781
|
);
|
|
1818
1782
|
}
|
|
1819
|
-
if (!existsSync6(
|
|
1783
|
+
if (!existsSync6(join9(resolvedPath, ".git"))) {
|
|
1820
1784
|
return check("warn", "vault_local_git", "Vault local git", "Not a git repository - sync features unavailable");
|
|
1821
1785
|
}
|
|
1822
1786
|
try {
|
|
@@ -1835,7 +1799,7 @@ function checkVaultGithubRemote(resolvedPath, exec) {
|
|
|
1835
1799
|
if (resolvedPath === void 0) {
|
|
1836
1800
|
return check("pass", "vault_github_remote", "Vault GitHub remote", "No vault path \u2014 check skipped");
|
|
1837
1801
|
}
|
|
1838
|
-
if (!existsSync6(
|
|
1802
|
+
if (!existsSync6(join9(resolvedPath, ".git"))) {
|
|
1839
1803
|
return check("pass", "vault_github_remote", "Vault GitHub remote", "No git repo \u2014 check skipped");
|
|
1840
1804
|
}
|
|
1841
1805
|
const state = probeGithubReachability(resolvedPath, exec);
|
|
@@ -1879,7 +1843,7 @@ function checkVaultPromotionLag(resolvedPath) {
|
|
|
1879
1843
|
if (resolvedPath === void 0) {
|
|
1880
1844
|
return check("pass", "vault_promotion_lag", "Vault promotion lag", "No vault path \u2014 check skipped");
|
|
1881
1845
|
}
|
|
1882
|
-
if (!existsSync6(
|
|
1846
|
+
if (!existsSync6(join9(resolvedPath, ".git"))) {
|
|
1883
1847
|
return check("pass", "vault_promotion_lag", "Vault promotion lag", "No git repo \u2014 check skipped");
|
|
1884
1848
|
}
|
|
1885
1849
|
try {
|
|
@@ -1930,11 +1894,11 @@ var gitFleetProbe = {
|
|
|
1930
1894
|
|
|
1931
1895
|
// src/doctor/probes/hygiene.ts
|
|
1932
1896
|
import { existsSync as existsSync8, readdirSync as readdirSync3, readFileSync as readFileSync5 } from "fs";
|
|
1933
|
-
import { join as
|
|
1897
|
+
import { join as join11 } from "path";
|
|
1934
1898
|
|
|
1935
1899
|
// src/utils/conflict-markers.ts
|
|
1936
1900
|
import { existsSync as existsSync7, readdirSync as readdirSync2, readFileSync as readFileSync4 } from "fs";
|
|
1937
|
-
import { join as
|
|
1901
|
+
import { join as join10 } from "path";
|
|
1938
1902
|
function scanConflictMarkerBlocksInText(relPath, text) {
|
|
1939
1903
|
const findings = [];
|
|
1940
1904
|
const lines = text.split(/\r?\n/);
|
|
@@ -1985,7 +1949,7 @@ function walkMarkdownFiles(root, dir, rel, out) {
|
|
|
1985
1949
|
for (const entry of entries) {
|
|
1986
1950
|
if (entry.isDirectory()) {
|
|
1987
1951
|
if (PRUNE_DIRS.has(entry.name)) continue;
|
|
1988
|
-
walkMarkdownFiles(root,
|
|
1952
|
+
walkMarkdownFiles(root, join10(dir, entry.name), rel ? `${rel}/${entry.name}` : entry.name, out);
|
|
1989
1953
|
} else if (entry.isFile() && entry.name.endsWith(".md")) {
|
|
1990
1954
|
out.push(rel ? `${rel}/${entry.name}` : entry.name);
|
|
1991
1955
|
}
|
|
@@ -1999,7 +1963,7 @@ function scanVaultConflictMarkers(vaultRoot) {
|
|
|
1999
1963
|
for (const rel of relPaths) {
|
|
2000
1964
|
let text;
|
|
2001
1965
|
try {
|
|
2002
|
-
text = readFileSync4(
|
|
1966
|
+
text = readFileSync4(join10(vaultRoot, rel), "utf8");
|
|
2003
1967
|
} catch {
|
|
2004
1968
|
continue;
|
|
2005
1969
|
}
|
|
@@ -2018,7 +1982,7 @@ function checkDotStoreClean(resolvedPath, mcpOnlyLeaf = false) {
|
|
|
2018
1982
|
check("error", "dsstore_clean", "No .DS_Store in raw/", "Cannot check \u2014 WIKI_PATH not resolved")
|
|
2019
1983
|
);
|
|
2020
1984
|
}
|
|
2021
|
-
const rawDir =
|
|
1985
|
+
const rawDir = join11(resolvedPath, "raw");
|
|
2022
1986
|
if (!existsSync8(rawDir)) {
|
|
2023
1987
|
return check("pass", "dsstore_clean", "No .DS_Store in raw/", "raw/ directory not found \u2014 check skipped");
|
|
2024
1988
|
}
|
|
@@ -2034,7 +1998,7 @@ function checkDotStoreClean(resolvedPath, mcpOnlyLeaf = false) {
|
|
|
2034
1998
|
if (entry.name === ".DS_Store") {
|
|
2035
1999
|
found.push(rel ? `${rel}/.DS_Store` : ".DS_Store");
|
|
2036
2000
|
} else if (entry.isDirectory()) {
|
|
2037
|
-
walk(
|
|
2001
|
+
walk(join11(dir, entry.name), rel ? `${rel}/${entry.name}` : entry.name);
|
|
2038
2002
|
}
|
|
2039
2003
|
}
|
|
2040
2004
|
})(rawDir, "");
|
|
@@ -2063,7 +2027,7 @@ function checkVaultConflictMarkers(resolvedPath) {
|
|
|
2063
2027
|
}
|
|
2064
2028
|
function githubSyncedGitRoot(gitRoot) {
|
|
2065
2029
|
if (gitRoot === void 0) return { ok: false, reason: "No vault path \u2014 check skipped" };
|
|
2066
|
-
if (!existsSync8(
|
|
2030
|
+
if (!existsSync8(join11(gitRoot, ".git"))) return { ok: false, reason: "Not a git repository \u2014 check skipped" };
|
|
2067
2031
|
if (!git(gitRoot, ["remote"])) return { ok: false, reason: "No git remote \u2014 not GitHub-synced, check skipped" };
|
|
2068
2032
|
return { ok: true, gitRoot };
|
|
2069
2033
|
}
|
|
@@ -2073,7 +2037,7 @@ function checkVaultGitignoreHygiene(synced) {
|
|
|
2073
2037
|
}
|
|
2074
2038
|
let content = "";
|
|
2075
2039
|
try {
|
|
2076
|
-
content = readFileSync5(
|
|
2040
|
+
content = readFileSync5(join11(synced.gitRoot, ".gitignore"), "utf8");
|
|
2077
2041
|
} catch {
|
|
2078
2042
|
content = "";
|
|
2079
2043
|
}
|
|
@@ -2121,7 +2085,7 @@ var hygieneProbe = {
|
|
|
2121
2085
|
|
|
2122
2086
|
// src/doctor/probes/s3-mount-health.ts
|
|
2123
2087
|
import { existsSync as existsSync10 } from "fs";
|
|
2124
|
-
import { join as
|
|
2088
|
+
import { join as join13 } from "path";
|
|
2125
2089
|
import { execSync as execSync4 } from "child_process";
|
|
2126
2090
|
|
|
2127
2091
|
// src/utils/s3-mount-health.ts
|
|
@@ -2130,7 +2094,7 @@ import { platform as platform2 } from "os";
|
|
|
2130
2094
|
import { readFileSync as readFileSync6 } from "fs";
|
|
2131
2095
|
import { readFile as readFile6, writeFile as writeFile2, unlink } from "fs/promises";
|
|
2132
2096
|
import { randomUUID } from "crypto";
|
|
2133
|
-
import { join as
|
|
2097
|
+
import { join as join12 } from "path";
|
|
2134
2098
|
var OS = platform2();
|
|
2135
2099
|
function findRcloneMountPid() {
|
|
2136
2100
|
try {
|
|
@@ -2288,7 +2252,7 @@ function detectFuseMount(vaultPath) {
|
|
|
2288
2252
|
return null;
|
|
2289
2253
|
}
|
|
2290
2254
|
async function writeTest(dir, options = {}) {
|
|
2291
|
-
const testFile =
|
|
2255
|
+
const testFile = join12(dir, options.fileName ?? `.doctor-write-test-${process.pid}.tmp`);
|
|
2292
2256
|
const io = options.io ?? {
|
|
2293
2257
|
write: (path, payload2) => writeFile2(path, payload2, "utf8"),
|
|
2294
2258
|
read: (path) => readFile6(path, "utf8"),
|
|
@@ -2378,7 +2342,7 @@ function checkS3MountPerf(resolvedPath) {
|
|
|
2378
2342
|
return check("pass", "s3_mount_perf", "S3 mount performance", "local disk");
|
|
2379
2343
|
}
|
|
2380
2344
|
const mountPoint = fuse.mountPoint;
|
|
2381
|
-
const conceptsDir =
|
|
2345
|
+
const conceptsDir = join13(resolvedPath, "concepts");
|
|
2382
2346
|
if (!existsSync10(conceptsDir)) {
|
|
2383
2347
|
return check("pass", "s3_mount_perf", "S3 mount performance", `S3 FUSE mount (${mountPoint}), no concepts/ to benchmark`);
|
|
2384
2348
|
}
|
|
@@ -2567,7 +2531,7 @@ async function checkWriteTest(resolvedPath) {
|
|
|
2567
2531
|
if (!fuse) {
|
|
2568
2532
|
return check("pass", "s3_write_test", "S3 write test", "local disk \u2014 check skipped");
|
|
2569
2533
|
}
|
|
2570
|
-
const conceptsDir =
|
|
2534
|
+
const conceptsDir = join13(resolvedPath, "concepts");
|
|
2571
2535
|
if (!existsSync10(conceptsDir)) {
|
|
2572
2536
|
return check("pass", "s3_write_test", "S3 write test", "no concepts/ dir to test \u2014 check skipped");
|
|
2573
2537
|
}
|
|
@@ -2668,7 +2632,7 @@ var s3MountHealthProbe = {
|
|
|
2668
2632
|
|
|
2669
2633
|
// src/doctor/probes/skills-plugins.ts
|
|
2670
2634
|
import { existsSync as existsSync11, readdirSync as readdirSync4, readFileSync as readFileSync7 } from "fs";
|
|
2671
|
-
import { join as
|
|
2635
|
+
import { join as join14 } from "path";
|
|
2672
2636
|
function findSkillMd(dir) {
|
|
2673
2637
|
const results = [];
|
|
2674
2638
|
let entries;
|
|
@@ -2679,9 +2643,9 @@ function findSkillMd(dir) {
|
|
|
2679
2643
|
}
|
|
2680
2644
|
for (const entry of entries) {
|
|
2681
2645
|
if (entry.isFile() && entry.name === "SKILL.md") {
|
|
2682
|
-
results.push(
|
|
2646
|
+
results.push(join14(dir, entry.name));
|
|
2683
2647
|
} else if (entry.isDirectory()) {
|
|
2684
|
-
results.push(...findSkillMd(
|
|
2648
|
+
results.push(...findSkillMd(join14(dir, entry.name)));
|
|
2685
2649
|
}
|
|
2686
2650
|
}
|
|
2687
2651
|
return results;
|
|
@@ -2695,18 +2659,18 @@ function findSkillNames(dir) {
|
|
|
2695
2659
|
return results;
|
|
2696
2660
|
}
|
|
2697
2661
|
for (const entry of entries) {
|
|
2698
|
-
if (entry.isDirectory() && existsSync11(
|
|
2662
|
+
if (entry.isDirectory() && existsSync11(join14(dir, entry.name, "SKILL.md"))) {
|
|
2699
2663
|
results.push(entry.name);
|
|
2700
2664
|
}
|
|
2701
2665
|
}
|
|
2702
2666
|
return results;
|
|
2703
2667
|
}
|
|
2704
2668
|
function findInstalledSkillMd(dir) {
|
|
2705
|
-
const directSkills = findSkillNames(dir).map((name) =>
|
|
2669
|
+
const directSkills = findSkillNames(dir).map((name) => join14(dir, name, "SKILL.md"));
|
|
2706
2670
|
return directSkills.length > 0 ? directSkills : findSkillMd(dir);
|
|
2707
2671
|
}
|
|
2708
2672
|
function checkSkillsInstalled(home, cwd) {
|
|
2709
|
-
const srcDir = cwd ?
|
|
2673
|
+
const srcDir = cwd ? join14(cwd, "packages", "skills") : void 0;
|
|
2710
2674
|
if (srcDir && existsSync11(srcDir)) {
|
|
2711
2675
|
const found = findInstalledSkillMd(srcDir);
|
|
2712
2676
|
if (found.length > 0) {
|
|
@@ -2720,7 +2684,7 @@ function checkSkillsInstalled(home, cwd) {
|
|
|
2720
2684
|
return check("pass", "skills_installed", "Skills installed", `${found.length} SKILL.md file(s) found (plugin v${plugin.version})`);
|
|
2721
2685
|
}
|
|
2722
2686
|
}
|
|
2723
|
-
const skillsDir =
|
|
2687
|
+
const skillsDir = join14(home, ".claude", "skills");
|
|
2724
2688
|
if (existsSync11(skillsDir)) {
|
|
2725
2689
|
const found = findInstalledSkillMd(skillsDir);
|
|
2726
2690
|
if (found.length > 0) {
|
|
@@ -2731,10 +2695,10 @@ function checkSkillsInstalled(home, cwd) {
|
|
|
2731
2695
|
}
|
|
2732
2696
|
function checkDuplicateSkills(home) {
|
|
2733
2697
|
const plugin = findPlugin(home);
|
|
2734
|
-
const skillsDir =
|
|
2698
|
+
const skillsDir = join14(home, ".claude", "skills");
|
|
2735
2699
|
const agentSkillDirs = [
|
|
2736
|
-
{ label: "~/.codex/skills/", path:
|
|
2737
|
-
{ label: "~/.agents/skills/", path:
|
|
2700
|
+
{ label: "~/.codex/skills/", path: join14(home, ".codex", "skills") },
|
|
2701
|
+
{ label: "~/.agents/skills/", path: join14(home, ".agents", "skills") }
|
|
2738
2702
|
];
|
|
2739
2703
|
if (!plugin) {
|
|
2740
2704
|
return check("pass", "skills_duplicate", "Skills not duplicated", "Single install channel");
|
|
@@ -2767,10 +2731,10 @@ var STALE_GROK_ACTIVATION_REFERENCE = "Read @skillwiki.md";
|
|
|
2767
2731
|
var ACTIVATION_FIX_HINT = "run `npm run install:activation` from the llm-wiki repo";
|
|
2768
2732
|
function findGrokActivationTemplate(home, cwd) {
|
|
2769
2733
|
if (cwd) {
|
|
2770
|
-
const src =
|
|
2734
|
+
const src = join14(cwd, "packages", "skills", "using-skillwiki", "activation.md");
|
|
2771
2735
|
if (existsSync11(src)) return src;
|
|
2772
2736
|
}
|
|
2773
|
-
const pluginsRoot =
|
|
2737
|
+
const pluginsRoot = join14(home, ".grok", "installed-plugins");
|
|
2774
2738
|
if (!existsSync11(pluginsRoot)) return void 0;
|
|
2775
2739
|
let entries;
|
|
2776
2740
|
try {
|
|
@@ -2780,21 +2744,21 @@ function findGrokActivationTemplate(home, cwd) {
|
|
|
2780
2744
|
}
|
|
2781
2745
|
for (const entry of entries) {
|
|
2782
2746
|
if (!entry.isDirectory()) continue;
|
|
2783
|
-
const root =
|
|
2747
|
+
const root = join14(pluginsRoot, entry.name);
|
|
2784
2748
|
for (const rel of ["using-skillwiki/activation.md", "skills/using-skillwiki/activation.md"]) {
|
|
2785
|
-
const candidate =
|
|
2749
|
+
const candidate = join14(root, rel);
|
|
2786
2750
|
if (existsSync11(candidate)) return candidate;
|
|
2787
2751
|
}
|
|
2788
2752
|
}
|
|
2789
2753
|
return void 0;
|
|
2790
2754
|
}
|
|
2791
2755
|
function checkGrokActivation(home, cwd) {
|
|
2792
|
-
const grokDir =
|
|
2756
|
+
const grokDir = join14(home, ".grok");
|
|
2793
2757
|
if (!existsSync11(grokDir)) {
|
|
2794
2758
|
return check("pass", "activation_grok", "Grok activation", "Not a Grok host");
|
|
2795
2759
|
}
|
|
2796
|
-
const activationPath =
|
|
2797
|
-
const agentsPath =
|
|
2760
|
+
const activationPath = join14(grokDir, "skillwiki.md");
|
|
2761
|
+
const agentsPath = join14(grokDir, "AGENTS.md");
|
|
2798
2762
|
const hasActivation = existsSync11(activationPath);
|
|
2799
2763
|
const issues = [];
|
|
2800
2764
|
if (!hasActivation) {
|
|
@@ -2909,7 +2873,7 @@ var skillsPluginsProbe = {
|
|
|
2909
2873
|
|
|
2910
2874
|
// src/doctor/probes/vault-sync.ts
|
|
2911
2875
|
import { existsSync as existsSync12, readFileSync as readFileSync8 } from "fs";
|
|
2912
|
-
import { join as
|
|
2876
|
+
import { join as join15 } from "path";
|
|
2913
2877
|
import { execSync as execSync5 } from "child_process";
|
|
2914
2878
|
import { platform as platform3 } from "os";
|
|
2915
2879
|
function readPushResultState(stateFile) {
|
|
@@ -2938,7 +2902,7 @@ function readPushResultState(stateFile) {
|
|
|
2938
2902
|
}
|
|
2939
2903
|
function readVaultSyncConfig(home) {
|
|
2940
2904
|
try {
|
|
2941
|
-
const content = readFileSync8(
|
|
2905
|
+
const content = readFileSync8(join15(home, ".skillwiki", ".env"), "utf8");
|
|
2942
2906
|
let installed = false;
|
|
2943
2907
|
let role;
|
|
2944
2908
|
let serviceScope;
|
|
@@ -3241,7 +3205,7 @@ function snapshotterHealthChecks(scope, logDir, env) {
|
|
|
3241
3205
|
let completionOutcome = "unknown";
|
|
3242
3206
|
const logRecords = fixture ? fixture.log_records : (() => {
|
|
3243
3207
|
try {
|
|
3244
|
-
const content = readFileSync8(
|
|
3208
|
+
const content = readFileSync8(join15(logDir, "wiki-snapshot.log"), "utf8");
|
|
3245
3209
|
return content.split(/\r?\n/).filter(Boolean);
|
|
3246
3210
|
} catch {
|
|
3247
3211
|
return [];
|
|
@@ -3419,11 +3383,11 @@ function vaultSyncChecks(input) {
|
|
|
3419
3383
|
];
|
|
3420
3384
|
}
|
|
3421
3385
|
const isMac = os === "darwin";
|
|
3422
|
-
const logDir = input.logDir ?? (isMac ?
|
|
3423
|
-
const cacheDir = input.cacheDir ?? (isMac ?
|
|
3424
|
-
const shareDir = input.shareDir ?? (isMac ?
|
|
3425
|
-
const filterPath = input.filterPath ??
|
|
3426
|
-
const packagedSnapshotPath =
|
|
3386
|
+
const logDir = input.logDir ?? (isMac ? join15(home, "Library", "Logs") : join15(home, ".local", "state", "vault-sync", "log"));
|
|
3387
|
+
const cacheDir = input.cacheDir ?? (isMac ? join15(home, "Library", "Caches", "vault-sync") : join15(home, ".cache", "vault-sync"));
|
|
3388
|
+
const shareDir = input.shareDir ?? (isMac ? join15(home, "Library", "Application Support", "vault-sync", "bin") : join15(home, ".local", "share", "vault-sync", "bin"));
|
|
3389
|
+
const filterPath = input.filterPath ?? join15(home, ".config", "rclone", "wiki-push-filters.txt");
|
|
3390
|
+
const packagedSnapshotPath = join15(shareDir, "wiki-snapshot.sh");
|
|
3427
3391
|
const legacySnapshotPath = "/root/.hermes/scripts/wiki-snapshot-v3.sh";
|
|
3428
3392
|
const snapshotPath = input.snapshotScriptPath ?? (existsSync12(packagedSnapshotPath) ? packagedSnapshotPath : legacySnapshotPath);
|
|
3429
3393
|
if (input.vaultSyncRole === "snapshotter") {
|
|
@@ -3480,9 +3444,9 @@ function vaultSyncChecks(input) {
|
|
|
3480
3444
|
return [c12, ...healthChecks, cFetch2, c42, c52];
|
|
3481
3445
|
}
|
|
3482
3446
|
const env = input.env ?? process.env;
|
|
3483
|
-
const fetchLogFile =
|
|
3447
|
+
const fetchLogFile = join15(logDir, "wiki-fetch.log");
|
|
3484
3448
|
if (input.pushEnabled === false) {
|
|
3485
|
-
const fetchHelperPath =
|
|
3449
|
+
const fetchHelperPath = join15(shareDir, "wiki-fetch-notify.sh");
|
|
3486
3450
|
const c12 = existsSync12(fetchHelperPath) ? check("pass", "vault_sync_installed", "Vault sync installed", `Found: ${fetchHelperPath}`) : check(
|
|
3487
3451
|
"error",
|
|
3488
3452
|
"vault_sync_installed",
|
|
@@ -3517,7 +3481,7 @@ function vaultSyncChecks(input) {
|
|
|
3517
3481
|
);
|
|
3518
3482
|
return [c12, c22, c32, cPushResult2, cFetch2, c42, c52];
|
|
3519
3483
|
}
|
|
3520
|
-
const pushScriptPath =
|
|
3484
|
+
const pushScriptPath = join15(shareDir, "wiki-push.sh");
|
|
3521
3485
|
const c1 = existsSync12(pushScriptPath) ? check("pass", "vault_sync_installed", "Vault sync installed", `Found: ${pushScriptPath}`) : check("error", "vault_sync_installed", "Vault sync installed", `Script not found at ${pushScriptPath} \u2014 run vault-sync-install`);
|
|
3522
3486
|
let c2;
|
|
3523
3487
|
try {
|
|
@@ -3569,9 +3533,9 @@ function vaultSyncChecks(input) {
|
|
|
3569
3533
|
"Scheduler check failed \u2014 run vault-sync-install"
|
|
3570
3534
|
);
|
|
3571
3535
|
}
|
|
3572
|
-
const stateFile =
|
|
3536
|
+
const stateFile = join15(cacheDir, "wiki-push-result.state");
|
|
3573
3537
|
const pushState = readPushResultState(stateFile);
|
|
3574
|
-
const logFile =
|
|
3538
|
+
const logFile = join15(logDir, "wiki-push.log");
|
|
3575
3539
|
let c3;
|
|
3576
3540
|
if (pushState.exists && !pushState.malformed && pushState.result === "refused") {
|
|
3577
3541
|
const reasonSuffix = pushState.reason ? `: ${pushState.reason}` : "";
|
|
@@ -3721,7 +3685,7 @@ function checkVaultSyncPullHelper(home, env) {
|
|
|
3721
3685
|
);
|
|
3722
3686
|
}
|
|
3723
3687
|
function isGitDir(path) {
|
|
3724
|
-
return Boolean(path && existsSync12(
|
|
3688
|
+
return Boolean(path && existsSync12(join15(path, ".git")));
|
|
3725
3689
|
}
|
|
3726
3690
|
function checkVaultSyncReviewRequiredJournals(ctx) {
|
|
3727
3691
|
const live = ctx.resolvedPath;
|
|
@@ -3816,10 +3780,10 @@ import { platform as platform4 } from "os";
|
|
|
3816
3780
|
|
|
3817
3781
|
// src/utils/satellite-run-health.ts
|
|
3818
3782
|
import { existsSync as existsSync13, readFileSync as readFileSync9 } from "fs";
|
|
3819
|
-
import { join as
|
|
3783
|
+
import { join as join16 } from "path";
|
|
3820
3784
|
var SATELLITE_STALE_MS = 26 * 60 * 60 * 1e3;
|
|
3821
3785
|
function satelliteLatestRunPath(vault) {
|
|
3822
|
-
return
|
|
3786
|
+
return join16(vault, ".skillwiki", "agent-memory-trends", "latest-run.json");
|
|
3823
3787
|
}
|
|
3824
3788
|
function isFailedRunStatus(status) {
|
|
3825
3789
|
return status === "fail" || status === "failure";
|
|
@@ -3961,7 +3925,7 @@ var satelliteProbe = {
|
|
|
3961
3925
|
|
|
3962
3926
|
// src/doctor/probes/metrics.ts
|
|
3963
3927
|
import { readFileSync as readFileSync10 } from "fs";
|
|
3964
|
-
import { join as
|
|
3928
|
+
import { join as join17 } from "path";
|
|
3965
3929
|
var METRIC_TYPES = ["entities", "concepts", "comparisons", "queries", "meta"];
|
|
3966
3930
|
function doctorReadOnlyScanRoot(resolvedPath) {
|
|
3967
3931
|
return resolveReadOnlyVaultRoot(resolvedPath).root;
|
|
@@ -4005,7 +3969,7 @@ async function vaultMetrics(resolvedPath) {
|
|
|
4005
3969
|
}
|
|
4006
3970
|
let logLines = 0;
|
|
4007
3971
|
try {
|
|
4008
|
-
logLines = readFileSync10(
|
|
3972
|
+
logLines = readFileSync10(join17(scanRoot, "log.md"), "utf8").split("\n").length;
|
|
4009
3973
|
} catch {
|
|
4010
3974
|
}
|
|
4011
3975
|
return [
|
|
@@ -4141,18 +4105,18 @@ var fuseStalenessProbe = {
|
|
|
4141
4105
|
|
|
4142
4106
|
// src/doctor/probes/activation-marker.ts
|
|
4143
4107
|
import { existsSync as existsSync15, readFileSync as readFileSync11, readdirSync as readdirSync5 } from "fs";
|
|
4144
|
-
import { join as
|
|
4108
|
+
import { join as join18 } from "path";
|
|
4145
4109
|
var GROK_ACTIVATION_REFERENCE2 = "Read @~/.grok/skillwiki.md for SkillWiki activation context.";
|
|
4146
4110
|
var STALE_GROK_ACTIVATION_REFERENCE2 = "Read @skillwiki.md";
|
|
4147
4111
|
var ACTIVATION_FIX_HINT2 = "run `npm run install:activation` from the llm-wiki repo";
|
|
4148
4112
|
function findGrokActivationTemplate2(home, cwd) {
|
|
4149
4113
|
if (cwd) {
|
|
4150
|
-
const src =
|
|
4114
|
+
const src = join18(cwd, "packages", "skills", "using-skillwiki", "activation.md");
|
|
4151
4115
|
if (existsSync15(src)) return src;
|
|
4152
|
-
const directSrc =
|
|
4116
|
+
const directSrc = join18(cwd, "skills", "using-skillwiki", "activation.md");
|
|
4153
4117
|
if (existsSync15(directSrc)) return directSrc;
|
|
4154
4118
|
}
|
|
4155
|
-
const pluginsRoot =
|
|
4119
|
+
const pluginsRoot = join18(home, ".grok", "installed-plugins");
|
|
4156
4120
|
if (!existsSync15(pluginsRoot)) return void 0;
|
|
4157
4121
|
let entries;
|
|
4158
4122
|
try {
|
|
@@ -4162,21 +4126,21 @@ function findGrokActivationTemplate2(home, cwd) {
|
|
|
4162
4126
|
}
|
|
4163
4127
|
for (const entry of entries) {
|
|
4164
4128
|
if (!entry.isDirectory()) continue;
|
|
4165
|
-
const root =
|
|
4129
|
+
const root = join18(pluginsRoot, entry.name);
|
|
4166
4130
|
for (const rel of ["using-skillwiki/activation.md", "skills/using-skillwiki/activation.md"]) {
|
|
4167
|
-
const candidate =
|
|
4131
|
+
const candidate = join18(root, rel);
|
|
4168
4132
|
if (existsSync15(candidate)) return candidate;
|
|
4169
4133
|
}
|
|
4170
4134
|
}
|
|
4171
4135
|
return void 0;
|
|
4172
4136
|
}
|
|
4173
4137
|
function checkActivationMarker(home, cwd) {
|
|
4174
|
-
const grokDir =
|
|
4138
|
+
const grokDir = join18(home, ".grok");
|
|
4175
4139
|
if (!existsSync15(grokDir)) {
|
|
4176
4140
|
return check("pass", "activation_marker", "Activation marker", "Not a Grok host \u2014 check skipped");
|
|
4177
4141
|
}
|
|
4178
|
-
const activationPath =
|
|
4179
|
-
const agentsPath =
|
|
4142
|
+
const activationPath = join18(grokDir, "skillwiki.md");
|
|
4143
|
+
const agentsPath = join18(grokDir, "AGENTS.md");
|
|
4180
4144
|
const hasActivation = existsSync15(activationPath);
|
|
4181
4145
|
const issues = [];
|
|
4182
4146
|
if (!hasActivation) {
|
|
@@ -4233,7 +4197,7 @@ var activationMarkerProbe = {
|
|
|
4233
4197
|
|
|
4234
4198
|
// src/doctor/probes/ds-store-noise.ts
|
|
4235
4199
|
import { existsSync as existsSync16, readdirSync as readdirSync6 } from "fs";
|
|
4236
|
-
import { join as
|
|
4200
|
+
import { join as join19 } from "path";
|
|
4237
4201
|
var VAULT_TRACKED_DIRS = ["raw", "entities", "concepts", "comparisons", "queries", "meta", "_archive", "_Templates"];
|
|
4238
4202
|
function checkDsStoreNoise(resolvedPath) {
|
|
4239
4203
|
if (resolvedPath === void 0) {
|
|
@@ -4255,13 +4219,13 @@ function checkDsStoreNoise(resolvedPath) {
|
|
|
4255
4219
|
found.push(rel ? `${rel}/.DS_Store` : ".DS_Store");
|
|
4256
4220
|
} else if (entry.isDirectory()) {
|
|
4257
4221
|
if (entry.name === ".git" || entry.name === "node_modules") continue;
|
|
4258
|
-
walk(
|
|
4222
|
+
walk(join19(dir, entry.name), rel ? `${rel}/${entry.name}` : entry.name);
|
|
4259
4223
|
}
|
|
4260
4224
|
}
|
|
4261
4225
|
}
|
|
4262
4226
|
let scannedAny = false;
|
|
4263
4227
|
for (const sub of VAULT_TRACKED_DIRS) {
|
|
4264
|
-
const subDir =
|
|
4228
|
+
const subDir = join19(resolvedPath, sub);
|
|
4265
4229
|
if (existsSync16(subDir)) {
|
|
4266
4230
|
scannedAny = true;
|
|
4267
4231
|
walk(subDir, sub);
|
|
@@ -4291,7 +4255,7 @@ var dsStoreNoiseProbe = {
|
|
|
4291
4255
|
|
|
4292
4256
|
// src/doctor/probes/mcp-handshake.ts
|
|
4293
4257
|
import { existsSync as existsSync17 } from "fs";
|
|
4294
|
-
import { join as
|
|
4258
|
+
import { join as join20 } from "path";
|
|
4295
4259
|
|
|
4296
4260
|
// src/utils/mcp-client.ts
|
|
4297
4261
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
@@ -4362,7 +4326,7 @@ function checkMcpCredential(ctx) {
|
|
|
4362
4326
|
}
|
|
4363
4327
|
function checkFrozenLeafWritePath(ctx) {
|
|
4364
4328
|
const vault = ctx.resolvedPath;
|
|
4365
|
-
if (!vault || !existsSync17(
|
|
4329
|
+
if (!vault || !existsSync17(join20(vault, ".WIKI_GIT_FROZEN"))) {
|
|
4366
4330
|
return check(
|
|
4367
4331
|
"pass",
|
|
4368
4332
|
"mcp_frozen_leaf_write_path",
|
|
@@ -4423,7 +4387,7 @@ async function checkMcpHandshake(ctx) {
|
|
|
4423
4387
|
if (!advertised) {
|
|
4424
4388
|
return handshakeRow("error", "handshake failed \u2014 missing serverInfo.version", token);
|
|
4425
4389
|
}
|
|
4426
|
-
const frozen = Boolean(ctx.resolvedPath && existsSync17(
|
|
4390
|
+
const frozen = Boolean(ctx.resolvedPath && existsSync17(join20(ctx.resolvedPath, ".WIKI_GIT_FROZEN")));
|
|
4427
4391
|
if (frozen && !tools.includes(WORKITEM_TOOL)) {
|
|
4428
4392
|
return handshakeRow(
|
|
4429
4393
|
"error",
|
|
@@ -4462,7 +4426,7 @@ var mcpHandshakeProbe = {
|
|
|
4462
4426
|
import { existsSync as existsSync18, readFileSync as readFileSync12 } from "fs";
|
|
4463
4427
|
import { execSync as execSync7 } from "child_process";
|
|
4464
4428
|
import { platform as platform6 } from "os";
|
|
4465
|
-
import { join as
|
|
4429
|
+
import { join as join21 } from "path";
|
|
4466
4430
|
var CLIP_CHECK_IDS = [
|
|
4467
4431
|
"clip_config",
|
|
4468
4432
|
"clip_frozen_mirror",
|
|
@@ -4525,7 +4489,7 @@ function watcherStatus(env, label, home, root) {
|
|
|
4525
4489
|
if (!launchdLoaded(label)) {
|
|
4526
4490
|
return { loaded: false, enabled: false, kind: "unknown" };
|
|
4527
4491
|
}
|
|
4528
|
-
const plist =
|
|
4492
|
+
const plist = join21(home, "Library", "LaunchAgents", `${label}.plist`);
|
|
4529
4493
|
try {
|
|
4530
4494
|
const text = readFileSync12(plist, "utf8");
|
|
4531
4495
|
const xmlRoot = xml(root);
|
|
@@ -4548,9 +4512,20 @@ function credentialPresent(env, ref) {
|
|
|
4548
4512
|
const value = env[ref];
|
|
4549
4513
|
return typeof value === "string" && value.length > 0;
|
|
4550
4514
|
}
|
|
4551
|
-
function listenerOk(env) {
|
|
4515
|
+
function listenerOk(env, home) {
|
|
4552
4516
|
if (env.CLIP_LISTENER_FIXTURE === "ok") return true;
|
|
4553
|
-
return false;
|
|
4517
|
+
if (env.CLIP_LISTENER_FIXTURE === "missing" || env.CLIP_LISTENER_FIXTURE === "disabled") return false;
|
|
4518
|
+
if (!launchdLoaded(PRODUCTION_MIRROR_LABEL)) return false;
|
|
4519
|
+
const plist = join21(home, "Library", "LaunchAgents", `${PRODUCTION_MIRROR_LABEL}.plist`);
|
|
4520
|
+
try {
|
|
4521
|
+
const text = readFileSync12(plist, "utf8");
|
|
4522
|
+
if (text.includes("<key>WatchPaths</key>")) return false;
|
|
4523
|
+
const disabled = execSync7(`launchctl print-disabled gui/${process.getuid()}`, { encoding: "utf8", timeout: 2e3, stdio: ["ignore", "pipe", "ignore"] });
|
|
4524
|
+
const explicitlyDisabled = disabled.split("\n").some((line) => line.includes(`"${PRODUCTION_MIRROR_LABEL}"`) && line.includes("true"));
|
|
4525
|
+
return text.includes("mirror-watch") && text.includes(PRODUCTION_MIRROR_LABEL) && !explicitlyDisabled;
|
|
4526
|
+
} catch {
|
|
4527
|
+
return false;
|
|
4528
|
+
}
|
|
4554
4529
|
}
|
|
4555
4530
|
function conditionalCreateEvidence(env) {
|
|
4556
4531
|
return env.CLIP_CONDITIONAL_CREATE_FIXTURE === "ok";
|
|
@@ -4575,7 +4550,7 @@ var clipOutboxProbe = {
|
|
|
4575
4550
|
return notConfigured();
|
|
4576
4551
|
}
|
|
4577
4552
|
const cfg = resolved.config;
|
|
4578
|
-
const frozen = existsSync18(
|
|
4553
|
+
const frozen = existsSync18(join21(cfg.mirrorRoot, ".WIKI_GIT_FROZEN"));
|
|
4579
4554
|
const pushOn = ctx.vsConfig.pushEnabled !== false;
|
|
4580
4555
|
const pushIsLoaded = pushLoaded(env);
|
|
4581
4556
|
const watch = watcherStatus(env, cfg.watcherLabel, ctx.input.home, cfg.root);
|
|
@@ -4594,7 +4569,7 @@ var clipOutboxProbe = {
|
|
|
4594
4569
|
condCreate = false;
|
|
4595
4570
|
}
|
|
4596
4571
|
}
|
|
4597
|
-
const listener = listenerOk(env);
|
|
4572
|
+
const listener = listenerOk(env, ctx.input.home);
|
|
4598
4573
|
return [
|
|
4599
4574
|
check("pass", "clip_config", clipLabel("clip_config"), "clip_outbox.enabled=true; schema valid"),
|
|
4600
4575
|
frozen ? check("pass", "clip_frozen_mirror", clipLabel("clip_frozen_mirror"), "frozen marker present") : check("error", "clip_frozen_mirror", clipLabel("clip_frozen_mirror"), "frozen marker missing; do not unfreeze"),
|
|
@@ -4603,7 +4578,7 @@ var clipOutboxProbe = {
|
|
|
4603
4578
|
watch.kind === "retired" ? check("error", "clip_watcher", clipLabel("clip_watcher"), "retired wiki-dev or D8 job does not satisfy the clip watcher") : watch.loaded && watch.enabled && watch.kind === "production" ? check("pass", "clip_watcher", clipLabel("clip_watcher"), `loaded and enabled: ${PRODUCTION_WATCHER_LABEL}`) : check("error", "clip_watcher", clipLabel("clip_watcher"), "production clip watcher not loaded and enabled"),
|
|
4604
4579
|
s3Creds && readyCreds && condCreate ? check("pass", "clip_storage_credentials", clipLabel("clip_storage_credentials"), "credential references present; conditional-create evidence available") : check("error", "clip_storage_credentials", clipLabel("clip_storage_credentials"), "missing credential reference or conditional-create evidence"),
|
|
4605
4580
|
readyCreds ? check("pass", "clip_ready_channel", clipLabel("clip_ready_channel"), "ready URL and credential reference present") : check("error", "clip_ready_channel", clipLabel("clip_ready_channel"), "ready credential missing"),
|
|
4606
|
-
listener ? check("pass", "clip_mirror_listener", clipLabel("clip_mirror_listener"),
|
|
4581
|
+
listener ? check("pass", "clip_mirror_listener", clipLabel("clip_mirror_listener"), `loaded and enabled: ${PRODUCTION_MIRROR_LABEL}`) : check("error", "clip_mirror_listener", clipLabel("clip_mirror_listener"), "inbound SSE listener disabled or missing")
|
|
4607
4582
|
];
|
|
4608
4583
|
}
|
|
4609
4584
|
};
|
|
@@ -4749,7 +4724,7 @@ function readCliPackageJson(baseUrl = import.meta.url) {
|
|
|
4749
4724
|
// src/utils/vault-write-gates.ts
|
|
4750
4725
|
import { execFileSync } from "child_process";
|
|
4751
4726
|
import { existsSync as existsSync20, readdirSync as readdirSync7, readFileSync as readFileSync14, statSync as statSync3 } from "fs";
|
|
4752
|
-
import { join as
|
|
4727
|
+
import { join as join22, relative as relative2 } from "path";
|
|
4753
4728
|
var DEFAULT_DIRTY_VOLUME_THRESHOLD = 50;
|
|
4754
4729
|
var DEFAULT_CAPTURE_BUDGET = 20;
|
|
4755
4730
|
var DEFAULT_NO_DECISION_STREAK = 3;
|
|
@@ -4805,7 +4780,7 @@ function isEventLedgerPath(rel) {
|
|
|
4805
4780
|
return n === "meta/log-events" || n.startsWith("meta/log-events/");
|
|
4806
4781
|
}
|
|
4807
4782
|
function countEventLedgerFiles(vault) {
|
|
4808
|
-
return listFilesRecursive(
|
|
4783
|
+
return listFilesRecursive(join22(vault, "meta", "log-events")).length;
|
|
4809
4784
|
}
|
|
4810
4785
|
function measureDirtyVolume(vault) {
|
|
4811
4786
|
const empty = (extra = {}) => ({
|
|
@@ -4865,7 +4840,7 @@ function measureDirtyVolume(vault) {
|
|
|
4865
4840
|
if (!rel) continue;
|
|
4866
4841
|
if (code === "??") {
|
|
4867
4842
|
untracked += 1;
|
|
4868
|
-
const abs =
|
|
4843
|
+
const abs = join22(vault, rel);
|
|
4869
4844
|
if (existsSync20(abs) && statSync3(abs).isDirectory()) {
|
|
4870
4845
|
const files = listFilesRecursive(abs);
|
|
4871
4846
|
expanded += files.length;
|
|
@@ -4909,7 +4884,7 @@ function listFilesRecursive(dir) {
|
|
|
4909
4884
|
}
|
|
4910
4885
|
for (const name of entries) {
|
|
4911
4886
|
if (name === ".git") continue;
|
|
4912
|
-
const p =
|
|
4887
|
+
const p = join22(dir, name);
|
|
4913
4888
|
try {
|
|
4914
4889
|
const st = statSync3(p);
|
|
4915
4890
|
if (st.isDirectory()) out.push(...listFilesRecursive(p));
|
|
@@ -5040,7 +5015,7 @@ function listProjectDayCaptures(vault, project, day) {
|
|
|
5040
5015
|
return;
|
|
5041
5016
|
}
|
|
5042
5017
|
for (const name of entries) {
|
|
5043
|
-
const abs =
|
|
5018
|
+
const abs = join22(dir, name);
|
|
5044
5019
|
const rel = relBase ? `${relBase}/${name}` : name;
|
|
5045
5020
|
try {
|
|
5046
5021
|
const st = statSync3(abs);
|
|
@@ -5050,16 +5025,16 @@ function listProjectDayCaptures(vault, project, day) {
|
|
|
5050
5025
|
}
|
|
5051
5026
|
}
|
|
5052
5027
|
};
|
|
5053
|
-
walk(
|
|
5054
|
-
walk(
|
|
5055
|
-
walk(
|
|
5056
|
-
const workRoot =
|
|
5028
|
+
walk(join22(vault, "raw", "transcripts"), "raw/transcripts");
|
|
5029
|
+
walk(join22(vault, "projects", slug, "raw", "transcripts"), `projects/${slug}/raw/transcripts`);
|
|
5030
|
+
walk(join22(vault, "projects", slug, "requirements"), `projects/${slug}/requirements`);
|
|
5031
|
+
const workRoot = join22(vault, "projects", slug, "work");
|
|
5057
5032
|
if (existsSync20(workRoot)) {
|
|
5058
5033
|
try {
|
|
5059
5034
|
for (const name of readdirSync7(workRoot)) {
|
|
5060
5035
|
if (!name.startsWith(day)) continue;
|
|
5061
5036
|
if (!/investigate|pilot-q|research|cycle|dev-loop/.test(name)) continue;
|
|
5062
|
-
const abs =
|
|
5037
|
+
const abs = join22(workRoot, name);
|
|
5063
5038
|
if (statSync3(abs).isDirectory()) {
|
|
5064
5039
|
for (const f of listFilesRecursive(abs)) {
|
|
5065
5040
|
const rel = relative2(vault, f).replace(/\\/g, "/");
|
|
@@ -5165,7 +5140,7 @@ function runWritePreflight(input) {
|
|
|
5165
5140
|
// src/commands/observe.ts
|
|
5166
5141
|
import { mkdir as mkdir3, writeFile as writeFile3 } from "fs/promises";
|
|
5167
5142
|
import { existsSync as existsSync21, statSync as statSync4 } from "fs";
|
|
5168
|
-
import { join as
|
|
5143
|
+
import { join as join23 } from "path";
|
|
5169
5144
|
import { createHash as createHash2 } from "crypto";
|
|
5170
5145
|
var ALLOWED_KINDS = /* @__PURE__ */ new Set(["note", "bug", "task", "idea", "session-log"]);
|
|
5171
5146
|
function slugify(text) {
|
|
@@ -5214,7 +5189,7 @@ async function runObserve(input) {
|
|
|
5214
5189
|
};
|
|
5215
5190
|
}
|
|
5216
5191
|
}
|
|
5217
|
-
const transcriptsDir =
|
|
5192
|
+
const transcriptsDir = join23(input.vault, "raw", "transcripts");
|
|
5218
5193
|
try {
|
|
5219
5194
|
await mkdir3(transcriptsDir, { recursive: true });
|
|
5220
5195
|
} catch {
|
|
@@ -5226,7 +5201,7 @@ async function runObserve(input) {
|
|
|
5226
5201
|
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
5227
5202
|
const slug = slugify(input.text);
|
|
5228
5203
|
const fileName = `${today}-observation-${slug}.md`;
|
|
5229
|
-
const filePath =
|
|
5204
|
+
const filePath = join23(transcriptsDir, fileName);
|
|
5230
5205
|
const body = `
|
|
5231
5206
|
${input.text.trim()}
|
|
5232
5207
|
`;
|
|
@@ -5268,7 +5243,7 @@ ${input.text.trim()}
|
|
|
5268
5243
|
// src/commands/memory.ts
|
|
5269
5244
|
import { createHash as createHash3 } from "crypto";
|
|
5270
5245
|
import { mkdir as mkdir4, readFile as readFile7, readdir as readdir2, stat as stat2, writeFile as writeFile4 } from "fs/promises";
|
|
5271
|
-
import { basename as basename2, extname, join as
|
|
5246
|
+
import { basename as basename2, extname, join as join24, relative as relative3, sep as sep2 } from "path";
|
|
5272
5247
|
|
|
5273
5248
|
// src/utils/memory-authority.ts
|
|
5274
5249
|
var TIER_RANK = {
|
|
@@ -5387,8 +5362,8 @@ async function runMemoryIndex(input) {
|
|
|
5387
5362
|
}
|
|
5388
5363
|
const generatedAt = (/* @__PURE__ */ new Date()).toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
5389
5364
|
const relCachePath = memoryCacheRelPath(input.project);
|
|
5390
|
-
const absCachePath =
|
|
5391
|
-
await mkdir4(
|
|
5365
|
+
const absCachePath = join24(input.vault, relCachePath);
|
|
5366
|
+
await mkdir4(join24(input.vault, ".skillwiki", "memory", input.project), { recursive: true });
|
|
5392
5367
|
await writeFile4(absCachePath, `${JSON.stringify({
|
|
5393
5368
|
generated_at: generatedAt,
|
|
5394
5369
|
project: input.project,
|
|
@@ -5580,7 +5555,7 @@ async function buildMemoryIndexState(pages, project) {
|
|
|
5580
5555
|
}
|
|
5581
5556
|
async function checkMemoryIndex(vault, project, current) {
|
|
5582
5557
|
const relCachePath = memoryCacheRelPath(project);
|
|
5583
|
-
const cacheText = await readIfExists(
|
|
5558
|
+
const cacheText = await readIfExists(join24(vault, relCachePath));
|
|
5584
5559
|
if (!cacheText) {
|
|
5585
5560
|
return {
|
|
5586
5561
|
ok: true,
|
|
@@ -5989,7 +5964,7 @@ async function walkImportFiles(dir, out) {
|
|
|
5989
5964
|
const entries = await readdir2(dir, { withFileTypes: true });
|
|
5990
5965
|
for (const entry of entries) {
|
|
5991
5966
|
if (entry.name === ".git" || entry.name === "node_modules") continue;
|
|
5992
|
-
const path =
|
|
5967
|
+
const path = join24(dir, entry.name);
|
|
5993
5968
|
if (entry.isDirectory()) {
|
|
5994
5969
|
await walkImportFiles(path, out);
|
|
5995
5970
|
} else if (entry.isFile() && isImportCandidate(path)) {
|
|
@@ -6056,8 +6031,8 @@ async function writeImportCapture(vault, entry, today) {
|
|
|
6056
6031
|
const content = hiddenString(entry, "__content");
|
|
6057
6032
|
const project = hiddenString(entry, "__project");
|
|
6058
6033
|
const relPath = await availableImportPath(vault, entry.proposed_path);
|
|
6059
|
-
const absPath =
|
|
6060
|
-
await mkdir4(
|
|
6034
|
+
const absPath = join24(vault, relPath);
|
|
6035
|
+
await mkdir4(join24(vault, "raw", "transcripts"), { recursive: true });
|
|
6061
6036
|
await writeFile4(absPath, renderImportCapture(entry, content, project, today), "utf8");
|
|
6062
6037
|
const validation = await runValidate({ file: absPath });
|
|
6063
6038
|
return {
|
|
@@ -6073,7 +6048,7 @@ async function availableImportPath(vault, proposed) {
|
|
|
6073
6048
|
const stem = proposed.slice(0, -ext.length);
|
|
6074
6049
|
let candidate = proposed;
|
|
6075
6050
|
let i = 2;
|
|
6076
|
-
while (await readIfExists(
|
|
6051
|
+
while (await readIfExists(join24(vault, candidate))) {
|
|
6077
6052
|
candidate = `${stem}-${i}${ext}`;
|
|
6078
6053
|
i++;
|
|
6079
6054
|
}
|
|
@@ -6258,10 +6233,10 @@ function memoryCacheRelPath(project) {
|
|
|
6258
6233
|
}
|
|
6259
6234
|
async function readMemoryCache(vault, project) {
|
|
6260
6235
|
if (project) {
|
|
6261
|
-
const projectCache = await readIfExists(
|
|
6236
|
+
const projectCache = await readIfExists(join24(vault, memoryCacheRelPath(project)));
|
|
6262
6237
|
if (projectCache) return projectCache;
|
|
6263
6238
|
}
|
|
6264
|
-
return readIfExists(
|
|
6239
|
+
return readIfExists(join24(vault, ".skillwiki", "memory-topics.json"));
|
|
6265
6240
|
}
|
|
6266
6241
|
function dedupePages(pages) {
|
|
6267
6242
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -6353,7 +6328,7 @@ function slugify2(value) {
|
|
|
6353
6328
|
|
|
6354
6329
|
// src/commands/query.ts
|
|
6355
6330
|
import { readFile as readFile9, stat as stat4 } from "fs/promises";
|
|
6356
|
-
import { join as
|
|
6331
|
+
import { join as join26 } from "path";
|
|
6357
6332
|
|
|
6358
6333
|
// src/utils/rrf.ts
|
|
6359
6334
|
var RRF_K = 60;
|
|
@@ -6369,7 +6344,7 @@ function fuseRankings(lists, k = RRF_K) {
|
|
|
6369
6344
|
|
|
6370
6345
|
// src/utils/vector-index.ts
|
|
6371
6346
|
import { mkdir as mkdir5, readFile as readFile8, stat as stat3 } from "fs/promises";
|
|
6372
|
-
import { join as
|
|
6347
|
+
import { join as join25 } from "path";
|
|
6373
6348
|
import { existsSync as existsSync22 } from "fs";
|
|
6374
6349
|
var VECTOR_INDEX_REL = ".skillwiki/vectors/index.json";
|
|
6375
6350
|
var VECTOR_INDEX_SCHEMA = "skillwiki-tfidf-index/v1";
|
|
@@ -6384,7 +6359,7 @@ function extractPageTokens(text) {
|
|
|
6384
6359
|
return tokenize(`${title} ${body}`);
|
|
6385
6360
|
}
|
|
6386
6361
|
function vectorIndexPath(vault) {
|
|
6387
|
-
return
|
|
6362
|
+
return join25(vault, ...VECTOR_INDEX_REL.split("/"));
|
|
6388
6363
|
}
|
|
6389
6364
|
function termFreq(tokens) {
|
|
6390
6365
|
const tf = /* @__PURE__ */ new Map();
|
|
@@ -6439,7 +6414,7 @@ async function buildVectorIndex(vault, now = (/* @__PURE__ */ new Date()).toISOS
|
|
|
6439
6414
|
docs
|
|
6440
6415
|
};
|
|
6441
6416
|
const dest = vectorIndexPath(vault);
|
|
6442
|
-
await mkdir5(
|
|
6417
|
+
await mkdir5(join25(vault, ".skillwiki", "vectors"), { recursive: true });
|
|
6443
6418
|
await atomicWriteText(dest, `${JSON.stringify(index)}
|
|
6444
6419
|
`);
|
|
6445
6420
|
return ok(index);
|
|
@@ -6482,7 +6457,7 @@ async function reindexPageInVectorIndex(vault, pageRelPath, now = (/* @__PURE__
|
|
|
6482
6457
|
if (!normalizedPage.endsWith(".md")) {
|
|
6483
6458
|
return err("USAGE", { message: `Page must be a .md file: ${pageRelPath}` });
|
|
6484
6459
|
}
|
|
6485
|
-
const absPath =
|
|
6460
|
+
const absPath = join25(vault, ...normalizedPage.split("/"));
|
|
6486
6461
|
let text;
|
|
6487
6462
|
try {
|
|
6488
6463
|
text = await readFile8(absPath, "utf8");
|
|
@@ -6567,7 +6542,7 @@ async function reindexPageInVectorIndex(vault, pageRelPath, now = (/* @__PURE__
|
|
|
6567
6542
|
}
|
|
6568
6543
|
}
|
|
6569
6544
|
const dest = vectorIndexPath(vault);
|
|
6570
|
-
await mkdir5(
|
|
6545
|
+
await mkdir5(join25(vault, ".skillwiki", "vectors"), { recursive: true });
|
|
6571
6546
|
await atomicWriteText(dest, `${JSON.stringify(index)}
|
|
6572
6547
|
`);
|
|
6573
6548
|
return ok({
|
|
@@ -6585,7 +6560,7 @@ async function pruneVectorIndex(vault, opts) {
|
|
|
6585
6560
|
const orphans = [];
|
|
6586
6561
|
for (const docKey of Object.keys(index.docs)) {
|
|
6587
6562
|
const normalizedKey = docKey.split(/\\|\//).join("/");
|
|
6588
|
-
const absPath =
|
|
6563
|
+
const absPath = join25(vault, ...normalizedKey.split("/"));
|
|
6589
6564
|
if (!existsSync22(absPath)) {
|
|
6590
6565
|
orphans.push(normalizedKey);
|
|
6591
6566
|
}
|
|
@@ -6632,7 +6607,7 @@ async function pruneVectorIndex(vault, opts) {
|
|
|
6632
6607
|
index.docs[docKey] = toTfIdf(termFreq(tokens), index.df, newPageCount);
|
|
6633
6608
|
} else {
|
|
6634
6609
|
try {
|
|
6635
|
-
const text = await readFile8(
|
|
6610
|
+
const text = await readFile8(join25(vault, ...docKey.split("/")), "utf8");
|
|
6636
6611
|
const tokens = extractPageTokens(text);
|
|
6637
6612
|
index.docs[docKey] = toTfIdf(termFreq(tokens), index.df, newPageCount);
|
|
6638
6613
|
} catch {
|
|
@@ -6642,7 +6617,7 @@ async function pruneVectorIndex(vault, opts) {
|
|
|
6642
6617
|
}
|
|
6643
6618
|
if (!opts?.dryRun) {
|
|
6644
6619
|
const dest = vectorIndexPath(vault);
|
|
6645
|
-
await mkdir5(
|
|
6620
|
+
await mkdir5(join25(vault, ".skillwiki", "vectors"), { recursive: true });
|
|
6646
6621
|
await atomicWriteText(dest, `${JSON.stringify(index)}
|
|
6647
6622
|
`);
|
|
6648
6623
|
}
|
|
@@ -6773,7 +6748,7 @@ async function runQuery(input) {
|
|
|
6773
6748
|
}
|
|
6774
6749
|
let pendingSources;
|
|
6775
6750
|
if (input.includePending) {
|
|
6776
|
-
const { runSourcesPending: runSourcesPending2 } = await import("./sources-
|
|
6751
|
+
const { runSourcesPending: runSourcesPending2 } = await import("./sources-E6KHDRDE.js");
|
|
6777
6752
|
const pending = await runSourcesPending2({
|
|
6778
6753
|
vault: input.vault,
|
|
6779
6754
|
match: input.text,
|
|
@@ -6943,7 +6918,7 @@ function computeKeywordScore(terms, title, tags, body, relPath) {
|
|
|
6943
6918
|
return score;
|
|
6944
6919
|
}
|
|
6945
6920
|
async function loadOrBuildGraph(vault) {
|
|
6946
|
-
const graphPath =
|
|
6921
|
+
const graphPath = join26(vault, ".skillwiki", "graph.json");
|
|
6947
6922
|
let needsBuild = false;
|
|
6948
6923
|
try {
|
|
6949
6924
|
const fileStat = await stat4(graphPath);
|
|
@@ -7032,7 +7007,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
7032
7007
|
import { z } from "zod";
|
|
7033
7008
|
|
|
7034
7009
|
// src/mcp/vault-resolve.ts
|
|
7035
|
-
import { join as
|
|
7010
|
+
import { join as join27, resolve as resolve4 } from "path";
|
|
7036
7011
|
|
|
7037
7012
|
// src/mcp/allowlist.ts
|
|
7038
7013
|
import { resolve as resolve3, sep as sep3 } from "path";
|
|
@@ -7094,7 +7069,7 @@ async function resolveMcpVault(input) {
|
|
|
7094
7069
|
return ok({ vault: vaultPath, source });
|
|
7095
7070
|
}
|
|
7096
7071
|
function defaultGraphOut(vault) {
|
|
7097
|
-
return
|
|
7072
|
+
return join27(vault, ".skillwiki", "graph.json");
|
|
7098
7073
|
}
|
|
7099
7074
|
|
|
7100
7075
|
// src/mcp/result-format.ts
|
|
@@ -7110,7 +7085,7 @@ function formatToolResult(payload) {
|
|
|
7110
7085
|
|
|
7111
7086
|
// src/mcp/audit-log.ts
|
|
7112
7087
|
import { appendFileSync, mkdirSync as mkdirSync2 } from "fs";
|
|
7113
|
-
import { join as
|
|
7088
|
+
import { join as join28 } from "path";
|
|
7114
7089
|
function auditEnabled() {
|
|
7115
7090
|
const v = process.env.SKILLWIKI_MCP_AUDIT;
|
|
7116
7091
|
if (v === "0" || v === "false") return false;
|
|
@@ -7122,7 +7097,7 @@ function auditSink() {
|
|
|
7122
7097
|
function auditFilePath() {
|
|
7123
7098
|
const custom = process.env.SKILLWIKI_MCP_AUDIT_FILE;
|
|
7124
7099
|
if (custom && custom.length > 0) return custom;
|
|
7125
|
-
return
|
|
7100
|
+
return join28(resolveSkillwikiHome(), ".skillwiki", "mcp-audit.jsonl");
|
|
7126
7101
|
}
|
|
7127
7102
|
function auditMcpToolCall(entry) {
|
|
7128
7103
|
if (!auditEnabled()) return;
|
|
@@ -7132,7 +7107,7 @@ function auditMcpToolCall(entry) {
|
|
|
7132
7107
|
return;
|
|
7133
7108
|
}
|
|
7134
7109
|
const path = auditFilePath();
|
|
7135
|
-
mkdirSync2(
|
|
7110
|
+
mkdirSync2(join28(path, ".."), { recursive: true });
|
|
7136
7111
|
appendFileSync(path, line, "utf8");
|
|
7137
7112
|
}
|
|
7138
7113
|
async function runMcpToolHandler(tool, input, fn) {
|
|
@@ -7407,7 +7382,7 @@ function registerMcpMutatingTools(server) {
|
|
|
7407
7382
|
|
|
7408
7383
|
// src/mcp/resources.ts
|
|
7409
7384
|
import { readFile as readFile11 } from "fs/promises";
|
|
7410
|
-
import { join as
|
|
7385
|
+
import { join as join30 } from "path";
|
|
7411
7386
|
import { ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
7412
7387
|
|
|
7413
7388
|
// src/mcp/lint-bucket.ts
|
|
@@ -7439,7 +7414,11 @@ var WARNING_KINDS = /* @__PURE__ */ new Set([
|
|
|
7439
7414
|
"orphaned_project_pages",
|
|
7440
7415
|
"missing_overview",
|
|
7441
7416
|
"missing_diagram",
|
|
7442
|
-
"cycle_traps"
|
|
7417
|
+
"cycle_traps",
|
|
7418
|
+
"ste_sentence_length",
|
|
7419
|
+
"ste_hedge_words",
|
|
7420
|
+
"ste_diagram_uncertainty",
|
|
7421
|
+
"ste_comparison_visual"
|
|
7443
7422
|
]);
|
|
7444
7423
|
function bucketSeverity(kind) {
|
|
7445
7424
|
if (ERROR_KINDS.has(kind)) return "error";
|
|
@@ -7537,7 +7516,7 @@ async function fetchQueryPreview(input) {
|
|
|
7537
7516
|
|
|
7538
7517
|
// src/mcp/graph-html.ts
|
|
7539
7518
|
import { readFile as readFile10 } from "fs/promises";
|
|
7540
|
-
import { join as
|
|
7519
|
+
import { join as join29 } from "path";
|
|
7541
7520
|
import { existsSync as existsSync23 } from "fs";
|
|
7542
7521
|
var TYPE_COLORS = {
|
|
7543
7522
|
entities: "#e74c3c",
|
|
@@ -7606,7 +7585,7 @@ ${nodeSvg}
|
|
|
7606
7585
|
return { html, node_count: nodes.length, edge_count: edges.length, truncated };
|
|
7607
7586
|
}
|
|
7608
7587
|
async function fetchGraphHtmlReport(input) {
|
|
7609
|
-
const graphPath = input.graphPath ??
|
|
7588
|
+
const graphPath = input.graphPath ?? join29(input.vault, ".skillwiki", "graph.json");
|
|
7610
7589
|
const maxNodes = Math.min(Math.max(10, input.maxNodes ?? 120), 500);
|
|
7611
7590
|
if (!existsSync23(graphPath)) {
|
|
7612
7591
|
return {
|
|
@@ -7680,7 +7659,7 @@ async function fetchStaleSummary(input) {
|
|
|
7680
7659
|
|
|
7681
7660
|
// src/mcp/resources.ts
|
|
7682
7661
|
async function readVaultFile(vault, rel) {
|
|
7683
|
-
return readFile11(
|
|
7662
|
+
return readFile11(join30(vault, rel), "utf8");
|
|
7684
7663
|
}
|
|
7685
7664
|
async function tailLines(text, lines) {
|
|
7686
7665
|
const parts = text.split(/\r?\n/);
|
|
@@ -7766,7 +7745,7 @@ function registerMcpResources(server) {
|
|
|
7766
7745
|
if (!v.ok) {
|
|
7767
7746
|
return { contents: [{ uri: uri.href, mimeType: "text/plain", text: JSON.stringify(v) }] };
|
|
7768
7747
|
}
|
|
7769
|
-
const path =
|
|
7748
|
+
const path = join30(v.data.vault, ".skillwiki", "graph.json");
|
|
7770
7749
|
try {
|
|
7771
7750
|
const raw = await readFile11(path, "utf8");
|
|
7772
7751
|
const graph = JSON.parse(raw);
|
|
@@ -8117,13 +8096,6 @@ export {
|
|
|
8117
8096
|
renderProjectIndex,
|
|
8118
8097
|
runProjectIndex,
|
|
8119
8098
|
scanConflictMarkerBlocksInText,
|
|
8120
|
-
MCP_URL_ENV,
|
|
8121
|
-
MCP_TOKEN_ENV,
|
|
8122
|
-
MCP_HOST_ID_ENV,
|
|
8123
|
-
nonEmptyEnvValue,
|
|
8124
|
-
mcpAuthFromEnv,
|
|
8125
|
-
mergeMcpAuthIntoEnv,
|
|
8126
|
-
redactMcpSecret,
|
|
8127
8099
|
configPath,
|
|
8128
8100
|
runConfigGet,
|
|
8129
8101
|
runConfigSet,
|