skillwiki 0.9.12 → 0.9.13

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 CHANGED
@@ -6183,6 +6183,10 @@ function readVaultSyncConfig(home) {
6183
6183
  const content = readFileSync7(join29(home, ".skillwiki", ".env"), "utf8");
6184
6184
  let installed = false;
6185
6185
  let role;
6186
+ let serviceScope;
6187
+ let snapshotScript;
6188
+ let snapshotProfile;
6189
+ let snapshotWorktree;
6186
6190
  for (const line of content.split(/\r?\n/)) {
6187
6191
  const trimmed = line.trim();
6188
6192
  if (trimmed.length === 0 || trimmed.startsWith("#")) continue;
@@ -6193,12 +6197,42 @@ function readVaultSyncConfig(home) {
6193
6197
  if (v.length === 0) continue;
6194
6198
  if (k === "vault_sync.installed" && v === "true") installed = true;
6195
6199
  if (k === "vault_sync.role") role = v;
6200
+ if (k === "vault_sync.service_scope") serviceScope = v;
6201
+ if (k === "vault_sync.snapshot_script") snapshotScript = v;
6202
+ if (k === "vault_sync.snapshot_profile") snapshotProfile = v;
6203
+ if (k === "vault_sync.snapshot_worktree") snapshotWorktree = v;
6196
6204
  }
6197
- return { installed, role };
6205
+ return { installed, role, serviceScope, snapshotScript, snapshotProfile, snapshotWorktree };
6198
6206
  } catch {
6199
6207
  return { installed: false };
6200
6208
  }
6201
6209
  }
6210
+ function readKeyFromEnvFile(path, keys) {
6211
+ try {
6212
+ const content = readFileSync7(path, "utf8");
6213
+ for (const line of content.split(/\r?\n/)) {
6214
+ const trimmed = line.trim();
6215
+ if (trimmed.length === 0 || trimmed.startsWith("#")) continue;
6216
+ const eq = trimmed.indexOf("=");
6217
+ if (eq <= 0) continue;
6218
+ const key = trimmed.slice(0, eq).trim();
6219
+ if (!keys.includes(key)) continue;
6220
+ const value = trimmed.slice(eq + 1).trim();
6221
+ if (value.length > 0) return value;
6222
+ }
6223
+ } catch {
6224
+ }
6225
+ return void 0;
6226
+ }
6227
+ function resolveSnapshotGitWorktree(config) {
6228
+ if (config.snapshotWorktree) return config.snapshotWorktree;
6229
+ if (config.snapshotProfile) {
6230
+ const fromProfile = readKeyFromEnvFile(config.snapshotProfile, ["WIKI_GIT_WORKTREE", "SNAPSHOT_WORKTREE", "GIT_DIR"]);
6231
+ if (fromProfile) return fromProfile;
6232
+ }
6233
+ const defaultPath = "/root/wiki-git";
6234
+ return existsSync11(defaultPath) ? defaultPath : void 0;
6235
+ }
6202
6236
  function vaultSyncChecks(input) {
6203
6237
  const os = input.os ?? platform2();
6204
6238
  const home = input.home;
@@ -6217,7 +6251,89 @@ function vaultSyncChecks(input) {
6217
6251
  const logDir = input.logDir ?? (isMac ? join29(home, "Library", "Logs") : join29(home, ".local", "state", "vault-sync", "log"));
6218
6252
  const shareDir = input.shareDir ?? (isMac ? join29(home, "Library", "Application Support", "vault-sync", "bin") : join29(home, ".local", "share", "vault-sync", "bin"));
6219
6253
  const filterPath = input.filterPath ?? join29(home, ".config", "rclone", "wiki-push-filters.txt");
6220
- const snapshotPath = input.snapshotScriptPath ?? "/root/.hermes/scripts/wiki-snapshot-v3.sh";
6254
+ const packagedSnapshotPath = join29(shareDir, "wiki-snapshot.sh");
6255
+ const legacySnapshotPath = "/root/.hermes/scripts/wiki-snapshot-v3.sh";
6256
+ const snapshotPath = input.snapshotScriptPath ?? (existsSync11(packagedSnapshotPath) ? packagedSnapshotPath : legacySnapshotPath);
6257
+ if (input.vaultSyncRole === "snapshotter") {
6258
+ const c12 = existsSync11(snapshotPath) ? check("pass", "vault_sync_installed", "Vault sync installed", `Found snapshot script: ${snapshotPath}`) : check("error", "vault_sync_installed", "Vault sync installed", `Snapshot script not found at ${snapshotPath}`);
6259
+ const serviceScope = input.vaultSyncServiceScope ?? "user";
6260
+ const userTimerPath = join29(home, ".config", "systemd", "user", "wiki-snapshot.timer");
6261
+ const systemTimerPath = "/etc/systemd/system/wiki-snapshot.timer";
6262
+ let c22;
6263
+ if (serviceScope === "user" && existsSync11(userTimerPath)) {
6264
+ c22 = check("pass", "vault_sync_jobs_enabled", "Vault sync jobs enabled", `Found: ${userTimerPath}`);
6265
+ } else if (serviceScope === "system" && existsSync11(systemTimerPath)) {
6266
+ c22 = check("pass", "vault_sync_jobs_enabled", "Vault sync jobs enabled", `Found: ${systemTimerPath}`);
6267
+ } else if (os !== "linux") {
6268
+ c22 = check("warn", "vault_sync_jobs_enabled", "Vault sync jobs enabled", "Snapshotter scheduler is Linux-only and no wiki-snapshot.timer file was found");
6269
+ } else {
6270
+ try {
6271
+ const command = serviceScope === "system" ? "systemctl is-enabled wiki-snapshot.timer" : "systemctl --user is-enabled wiki-snapshot.timer";
6272
+ const out = execSync2(command, {
6273
+ encoding: "utf8",
6274
+ timeout: 2e3,
6275
+ stdio: ["pipe", "pipe", "pipe"]
6276
+ }).trim();
6277
+ c22 = out === "enabled" ? check("pass", "vault_sync_jobs_enabled", "Vault sync jobs enabled", `systemd: wiki-snapshot.timer enabled (${serviceScope})`) : check("error", "vault_sync_jobs_enabled", "Vault sync jobs enabled", `systemd: wiki-snapshot.timer is ${out || "not enabled"} (${serviceScope})`);
6278
+ } catch {
6279
+ c22 = check("error", "vault_sync_jobs_enabled", "Vault sync jobs enabled", `wiki-snapshot.timer check failed (${serviceScope})`);
6280
+ }
6281
+ }
6282
+ const c32 = check(
6283
+ "pass",
6284
+ "vault_sync_last_push_age",
6285
+ "Vault sync last push recency",
6286
+ "Snapshotter host \u2014 leaf wiki-push log not applicable"
6287
+ );
6288
+ const cFetch2 = check(
6289
+ "pass",
6290
+ "vault_sync_last_fetch_status",
6291
+ "Vault sync last fetch status",
6292
+ "Snapshotter host \u2014 leaf wiki-fetch-notify log not applicable"
6293
+ );
6294
+ const c42 = check(
6295
+ "pass",
6296
+ "vault_sync_filter_present",
6297
+ "Vault sync filter file present",
6298
+ "Snapshotter host \u2014 leaf wiki-push filter not applicable"
6299
+ );
6300
+ let c52;
6301
+ try {
6302
+ if (!existsSync11(snapshotPath)) {
6303
+ c52 = check(
6304
+ "error",
6305
+ "vault_sync_snapshot_guard",
6306
+ "Snapshot script guard",
6307
+ `Snapshot script not found at ${snapshotPath}`
6308
+ );
6309
+ } else {
6310
+ const content = readFileSync7(snapshotPath, "utf8");
6311
+ if (!content.includes("--max-delete")) {
6312
+ c52 = check(
6313
+ "error",
6314
+ "vault_sync_snapshot_guard",
6315
+ "Snapshot script guard",
6316
+ `${snapshotPath} is missing --max-delete guard \u2014 dangerous without it`
6317
+ );
6318
+ } else {
6319
+ c52 = check(
6320
+ "pass",
6321
+ "vault_sync_snapshot_guard",
6322
+ "Snapshot script guard",
6323
+ `--max-delete present in ${snapshotPath}`
6324
+ );
6325
+ }
6326
+ }
6327
+ } catch {
6328
+ c52 = check(
6329
+ "error",
6330
+ "vault_sync_snapshot_guard",
6331
+ "Snapshot script guard",
6332
+ `Cannot read ${snapshotPath}`
6333
+ );
6334
+ }
6335
+ return [c12, c22, c32, cFetch2, c42, c52];
6336
+ }
6221
6337
  const pushScriptPath = join29(shareDir, "wiki-push.sh");
6222
6338
  const c1 = existsSync11(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`);
6223
6339
  let c2;
@@ -6576,20 +6692,21 @@ async function runDoctor(input) {
6576
6692
  checks.push(check("error", "wiki_path_set", "WIKI_PATH configured", "No vault configured. Run `skillwiki init` or pass --vault."));
6577
6693
  }
6578
6694
  const resolvedPath = resolved.ok ? resolved.data.path : void 0;
6695
+ const gitCheckPath = vsConfig.role === "snapshotter" ? resolveSnapshotGitWorktree(vsConfig) ?? resolvedPath : resolvedPath;
6579
6696
  checks.push(checkWikiPathExists(resolvedPath));
6580
6697
  checks.push(checkVaultStructure(resolvedPath));
6581
6698
  checks.push(checkObsidianTemplates(resolvedPath));
6582
- checks.push(checkVaultGitRemote(resolvedPath));
6699
+ checks.push(checkVaultGitRemote(gitCheckPath));
6583
6700
  checks.push(await checkFleetIdentity({
6584
6701
  vaultPath: resolvedPath,
6585
6702
  home: input.home,
6586
6703
  cwd: input.cwd,
6587
6704
  envValue: input.envValue
6588
6705
  }));
6589
- checks.push(checkSyncLastPush(resolvedPath));
6590
- checks.push(checkVaultGitDirty(resolvedPath));
6591
- checks.push(checkVaultGitAhead(resolvedPath));
6592
- checks.push(checkVaultGitBehind(resolvedPath));
6706
+ checks.push(checkSyncLastPush(gitCheckPath));
6707
+ checks.push(checkVaultGitDirty(gitCheckPath));
6708
+ checks.push(checkVaultGitAhead(gitCheckPath));
6709
+ checks.push(checkVaultGitBehind(gitCheckPath));
6593
6710
  checks.push(checkVaultGitPullFailures(input.home));
6594
6711
  checks.push(checkDotStoreClean(resolvedPath));
6595
6712
  checks.push(checkS3MountPerf(resolvedPath));
@@ -6605,7 +6722,9 @@ async function runDoctor(input) {
6605
6722
  checks.push(...vaultSyncChecks({
6606
6723
  home: input.home,
6607
6724
  vaultSyncInstalled: vsConfig.installed,
6608
- vaultSyncRole: vsConfig.role
6725
+ vaultSyncRole: vsConfig.role,
6726
+ vaultSyncServiceScope: vsConfig.serviceScope,
6727
+ snapshotScriptPath: vsConfig.snapshotScript
6609
6728
  }));
6610
6729
  checks.push(...await vaultMetrics(resolvedPath));
6611
6730
  const summary = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skillwiki",
3
- "version": "0.9.12",
3
+ "version": "0.9.13",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "skillwiki": "dist/cli.js"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skillwiki",
3
- "version": "0.9.12",
3
+ "version": "0.9.13",
4
4
  "skills": "./",
5
5
  "description": "Project-aware Karpathy-style knowledge base for Claude Code: 18 prompt-only skills (wiki-*, proj-*, using-skillwiki) backed by the deterministic `skillwiki` CLI.",
6
6
  "author": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skillwiki",
3
- "version": "0.9.12",
3
+ "version": "0.9.13",
4
4
  "description": "Project-aware Karpathy-style knowledge base for Codex with 18 prompt-only skills backed by the deterministic skillwiki CLI.",
5
5
  "author": {
6
6
  "name": "karlorz",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skillwiki/skills",
3
- "version": "0.9.12",
3
+ "version": "0.9.13",
4
4
  "private": true,
5
5
  "files": [
6
6
  "wiki-*",