skillwiki 0.10.50 → 0.10.52

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.
@@ -35,7 +35,7 @@ import {
35
35
  snapshotterAliasForLocalHost,
36
36
  toUndirectedWeighted,
37
37
  writeDotenv
38
- } from "./chunk-EUTNN4RN.js";
38
+ } from "./chunk-VRK5DOC5.js";
39
39
  import {
40
40
  atomicWriteText,
41
41
  prepareTypedPage
@@ -605,9 +605,9 @@ function safeUserName() {
605
605
  }
606
606
 
607
607
  // src/commands/sync.ts
608
- import { existsSync as existsSync8 } from "fs";
608
+ import { existsSync as existsSync8, readFileSync as readFileSync5 } from "fs";
609
609
  import { join as join17 } from "path";
610
- import { execFileSync as execFileSync3 } from "child_process";
610
+ import { execFileSync as execFileSync4 } from "child_process";
611
611
 
612
612
  // src/utils/last-op.ts
613
613
  import { readFileSync, writeFileSync, mkdirSync, unlinkSync, existsSync } from "fs";
@@ -5037,6 +5037,41 @@ var LINT_RULES = [
5037
5037
  cycleTrapsRule
5038
5038
  ];
5039
5039
 
5040
+ // src/utils/git-archive.ts
5041
+ import { execFileSync } from "child_process";
5042
+ import { rmSync } from "fs";
5043
+ function extractGitTree(vault, ref, destDir) {
5044
+ if (process.platform === "win32") {
5045
+ const zipPath = `${destDir}.zip`;
5046
+ execFileSync("git", ["archive", "--format=zip", `--output=${zipPath}`, ref], {
5047
+ cwd: vault,
5048
+ stdio: ["pipe", "pipe", "pipe"]
5049
+ });
5050
+ try {
5051
+ execFileSync("tar", ["-xf", zipPath], {
5052
+ cwd: destDir,
5053
+ stdio: ["pipe", "pipe", "pipe"]
5054
+ });
5055
+ } finally {
5056
+ try {
5057
+ rmSync(zipPath, { force: true });
5058
+ } catch {
5059
+ }
5060
+ }
5061
+ return;
5062
+ }
5063
+ const archive = execFileSync("git", ["archive", "--format=tar", ref], {
5064
+ cwd: vault,
5065
+ stdio: ["pipe", "pipe", "pipe"],
5066
+ maxBuffer: 256 * 1024 * 1024
5067
+ });
5068
+ execFileSync("tar", ["-xf", "-"], {
5069
+ cwd: destDir,
5070
+ input: archive,
5071
+ stdio: ["pipe", "pipe", "pipe"]
5072
+ });
5073
+ }
5074
+
5040
5075
  // src/lint/runner.ts
5041
5076
  var LintRunner = class {
5042
5077
  rules;
@@ -5183,10 +5218,10 @@ function runLint(input) {
5183
5218
  return defaultLintRunner.run(input);
5184
5219
  }
5185
5220
  async function runSyncLintDelta(input) {
5186
- const { mkdtempSync, rmSync, existsSync: fsExists } = await import("fs");
5221
+ const { mkdtempSync, rmSync: rmSync2, existsSync: fsExists } = await import("fs");
5187
5222
  const { join: pathJoin } = await import("path");
5188
5223
  const { tmpdir } = await import("os");
5189
- const { execFileSync: execFileSync4 } = await import("child_process");
5224
+ const { execFileSync: execFileSync5 } = await import("child_process");
5190
5225
  const vault = input.vault;
5191
5226
  const baseRef = input.baseRef ?? "origin/main";
5192
5227
  const days = input.days ?? 90;
@@ -5199,7 +5234,7 @@ async function runSyncLintDelta(input) {
5199
5234
  };
5200
5235
  }
5201
5236
  try {
5202
- execFileSync4("git", ["rev-parse", "--verify", baseRef], {
5237
+ execFileSync5("git", ["rev-parse", "--verify", baseRef], {
5203
5238
  cwd: vault,
5204
5239
  stdio: ["pipe", "pipe", "pipe"]
5205
5240
  });
@@ -5229,16 +5264,7 @@ async function runSyncLintDelta(input) {
5229
5264
  const fullFps = collectLintErrorFingerprints(fullOutput);
5230
5265
  const tmpRoot = mkdtempSync(pathJoin(tmpdir(), "skillwiki-lint-delta-"));
5231
5266
  try {
5232
- const archive = execFileSync4("git", ["archive", "--format=tar", baseRef], {
5233
- cwd: vault,
5234
- stdio: ["pipe", "pipe", "pipe"],
5235
- maxBuffer: 256 * 1024 * 1024
5236
- });
5237
- execFileSync4("tar", ["-xf", "-"], {
5238
- cwd: tmpRoot,
5239
- input: archive,
5240
- stdio: ["pipe", "pipe", "pipe"]
5241
- });
5267
+ extractGitTree(vault, baseRef, tmpRoot);
5242
5268
  if (!fsExists(pathJoin(tmpRoot, "SCHEMA.md"))) {
5243
5269
  }
5244
5270
  const baseLint = await runLint({ vault: tmpRoot, days, lines, logThreshold });
@@ -5293,23 +5319,23 @@ async function runSyncLintDelta(input) {
5293
5319
  };
5294
5320
  } finally {
5295
5321
  try {
5296
- rmSync(tmpRoot, { recursive: true, force: true });
5322
+ rmSync2(tmpRoot, { recursive: true, force: true });
5297
5323
  } catch {
5298
5324
  }
5299
5325
  }
5300
5326
  }
5301
5327
 
5302
5328
  // src/utils/git.ts
5303
- import { execFileSync } from "child_process";
5329
+ import { execFileSync as execFileSync2 } from "child_process";
5304
5330
  function git(cwd, args) {
5305
5331
  try {
5306
- return execFileSync("git", args, { cwd, encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] }).trim();
5332
+ return execFileSync2("git", args, { cwd, encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] }).trim();
5307
5333
  } catch {
5308
5334
  return "";
5309
5335
  }
5310
5336
  }
5311
5337
  function gitStrict(cwd, args) {
5312
- return execFileSync("git", args, { cwd, encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] }).trim();
5338
+ return execFileSync2("git", args, { cwd, encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] }).trim();
5313
5339
  }
5314
5340
 
5315
5341
  // src/utils/sync-lock.ts
@@ -5494,9 +5520,9 @@ function stageVaultContentChanges(vault) {
5494
5520
  // src/utils/remote-health.ts
5495
5521
  import { existsSync as existsSync6, readFileSync as readFileSync4 } from "fs";
5496
5522
  import { join as join15 } from "path";
5497
- import { execFileSync as execFileSync2 } from "child_process";
5523
+ import { execFileSync as execFileSync3 } from "child_process";
5498
5524
  var REMOTE_PROBE_TIMEOUT_MS = 3e3;
5499
- var defaultExec = (file, args, cwd) => execFileSync2(file, args, {
5525
+ var defaultExec = (file, args, cwd) => execFileSync3(file, args, {
5500
5526
  cwd,
5501
5527
  encoding: "utf8",
5502
5528
  stdio: ["pipe", "pipe", "pipe"],
@@ -5716,7 +5742,7 @@ function isTrackedNotePath(path) {
5716
5742
  }
5717
5743
  function refHasPath(vault, ref, path) {
5718
5744
  try {
5719
- execFileSync3("git", ["cat-file", "-e", `${ref}:${path}`], {
5745
+ execFileSync4("git", ["cat-file", "-e", `${ref}:${path}`], {
5720
5746
  cwd: vault,
5721
5747
  stdio: ["pipe", "pipe", "pipe"]
5722
5748
  });
@@ -6081,17 +6107,44 @@ var MANAGED_WRITER_SPECS = [
6081
6107
  // never match.
6082
6108
  ["rclone", /(?:^rclone(?:\.exe)?$)|(?:\brclone(?:\.exe)?\s+(?:copy|sync|move|delete|purge|deletefile|copyto|moveto|dedupe|mkdir|rmdir|rmdirs|touch|settier|bisync|copyurl)(?:\s|$))/i],
6083
6109
  // Writing helper scripts on Unix; Windows image name only.
6110
+ // The invoking process tree is excluded separately so snapshot/pull
6111
+ // children can run managed writes without live-writer-overlap.
6084
6112
  ["vault-sync", /(?:^vault-sync(?:\.exe)?$)|(?:wiki-(?:snapshot|pull-with-auto-resolve|git-repair-v3)\.sh(?:\s|$))/i]
6085
6113
  ];
6086
6114
  var MANAGED_WRITER_KINDS = MANAGED_WRITER_SPECS.map(([kind]) => kind);
6115
+ function collectManagedWriterAncestorPids(startPid, readStatus = readProcStatus) {
6116
+ const ids = /* @__PURE__ */ new Set();
6117
+ let pid = startPid;
6118
+ for (let i = 0; i < 64; i++) {
6119
+ if (!Number.isInteger(pid) || pid <= 1) break;
6120
+ const status = readStatus(pid);
6121
+ if (status == null) break;
6122
+ const match = status.match(/^PPid:\s+(\d+)/m);
6123
+ if (!match) break;
6124
+ const ppid = Number(match[1]);
6125
+ if (!Number.isInteger(ppid) || ppid <= 0 || ids.has(ppid)) break;
6126
+ ids.add(ppid);
6127
+ pid = ppid;
6128
+ }
6129
+ return ids;
6130
+ }
6131
+ function readProcStatus(pid) {
6132
+ if (process.platform !== "linux") return null;
6133
+ try {
6134
+ return readFileSync5(`/proc/${pid}/status`, "utf8");
6135
+ } catch {
6136
+ return null;
6137
+ }
6138
+ }
6087
6139
  function classifyStash(ageMinutes, sessionId, currentSession) {
6088
6140
  if (sessionId && sessionId === currentSession) return "self_or_local_recovery_stash";
6089
6141
  if (sessionId && ageMinutes <= STASH_RECENT_MINUTES) return "recent_known_peer_stash";
6090
6142
  if (ageMinutes > STASH_RECENT_MINUTES) return "stale_stash_backlog";
6091
6143
  return "unknown_stash_ownership";
6092
6144
  }
6093
- function classifyManagedWriterProcesses(snapshot, currentPid = process.pid) {
6145
+ function classifyManagedWriterProcesses(snapshot, currentPid = process.pid, ancestorPids = collectManagedWriterAncestorPids(currentPid)) {
6094
6146
  const kinds = /* @__PURE__ */ new Set();
6147
+ const ancestors = ancestorPids instanceof Set ? ancestorPids : new Set(ancestorPids);
6095
6148
  let count = 0;
6096
6149
  for (const line of snapshot.split(/\r?\n/)) {
6097
6150
  const trimmed = line.trim();
@@ -6108,7 +6161,7 @@ function classifyManagedWriterProcesses(snapshot, currentPid = process.pid) {
6108
6161
  pid = Number(pidMatch[1]);
6109
6162
  processName = pidMatch[2];
6110
6163
  }
6111
- if (pid === currentPid) continue;
6164
+ if (pid === currentPid || ancestors.has(pid)) continue;
6112
6165
  const kind = MANAGED_WRITER_SPECS.find(([, pattern]) => pattern.test(processName))?.[0];
6113
6166
  if (!kind) continue;
6114
6167
  count += 1;
@@ -6119,12 +6172,12 @@ function classifyManagedWriterProcesses(snapshot, currentPid = process.pid) {
6119
6172
  function managedWriterSnapshot() {
6120
6173
  try {
6121
6174
  if (process.platform === "win32") {
6122
- return execFileSync3("tasklist", ["/FO", "CSV", "/NH"], {
6175
+ return execFileSync4("tasklist", ["/FO", "CSV", "/NH"], {
6123
6176
  encoding: "utf8",
6124
6177
  stdio: ["pipe", "pipe", "pipe"]
6125
6178
  });
6126
6179
  }
6127
- return execFileSync3("ps", ["-axo", "pid=,command="], {
6180
+ return execFileSync4("ps", ["-axo", "pid=,command="], {
6128
6181
  encoding: "utf8",
6129
6182
  stdio: ["pipe", "pipe", "pipe"]
6130
6183
  });
@@ -6287,7 +6340,7 @@ import { randomBytes as randomBytes2 } from "crypto";
6287
6340
  import {
6288
6341
  existsSync as existsSync9,
6289
6342
  mkdirSync as mkdirSync4,
6290
- readFileSync as readFileSync5,
6343
+ readFileSync as readFileSync6,
6291
6344
  unlinkSync as unlinkSync3,
6292
6345
  writeFileSync as writeFileSync4
6293
6346
  } from "fs";
@@ -6300,7 +6353,7 @@ function managedWriteLockPath(vault) {
6300
6353
  }
6301
6354
  function readLockRecord(path) {
6302
6355
  try {
6303
- return JSON.parse(readFileSync5(path, "utf8"));
6356
+ return JSON.parse(readFileSync6(path, "utf8"));
6304
6357
  } catch {
6305
6358
  return null;
6306
6359
  }
@@ -6421,7 +6474,7 @@ function acquireManagedWriteLock(vault, command, options = {}) {
6421
6474
  }
6422
6475
  function releaseManagedWriteLock(handle) {
6423
6476
  try {
6424
- const parsed = JSON.parse(readFileSync5(handle.path, "utf8"));
6477
+ const parsed = JSON.parse(readFileSync6(handle.path, "utf8"));
6425
6478
  if (parsed.owner_token !== handle.ownerToken || parsed.acquired !== handle.acquired) {
6426
6479
  return err("SYNC_LOCK_HELD", {
6427
6480
  path: handle.path,
@@ -6440,7 +6493,7 @@ import {
6440
6493
  existsSync as existsSync10,
6441
6494
  mkdirSync as mkdirSync5,
6442
6495
  readdirSync,
6443
- readFileSync as readFileSync6,
6496
+ readFileSync as readFileSync7,
6444
6497
  renameSync as renameSync2,
6445
6498
  writeFileSync as writeFileSync5
6446
6499
  } from "fs";
@@ -6475,7 +6528,7 @@ function readJournal(vault, opId) {
6475
6528
  const path = join19(dir, `${opId}.env`);
6476
6529
  if (!existsSync10(path)) return null;
6477
6530
  try {
6478
- return parseJournalEnv(readFileSync6(path, "utf8"));
6531
+ return parseJournalEnv(readFileSync7(path, "utf8"));
6479
6532
  } catch {
6480
6533
  return null;
6481
6534
  }
@@ -6623,11 +6676,11 @@ function supersedeStaleReviewRequiredJournals(vault, opts = {}) {
6623
6676
  }
6624
6677
 
6625
6678
  // src/utils/snapshot-worktree.ts
6626
- import { readFileSync as readFileSync7 } from "fs";
6679
+ import { readFileSync as readFileSync8 } from "fs";
6627
6680
  import { join as join20, resolve as resolve5 } from "path";
6628
6681
  function readSkillWikiConfig(path) {
6629
6682
  try {
6630
- return parseDotenvText(readFileSync7(path, "utf8"));
6683
+ return parseDotenvText(readFileSync8(path, "utf8"));
6631
6684
  } catch {
6632
6685
  return {};
6633
6686
  }
@@ -6636,7 +6689,7 @@ function readSnapshotProfile(path) {
6636
6689
  const allowed = /* @__PURE__ */ new Set(["WIKI_GIT_WORKTREE", "SNAPSHOT_WORKTREE", "GIT_DIR"]);
6637
6690
  const profile = {};
6638
6691
  try {
6639
- for (const rawLine of readFileSync7(path, "utf8").split(/\r?\n/)) {
6692
+ for (const rawLine of readFileSync8(path, "utf8").split(/\r?\n/)) {
6640
6693
  const line = rawLine.trim();
6641
6694
  if (line.length === 0 || line.startsWith("#")) continue;
6642
6695
  const eq = line.indexOf("=");
@@ -7077,6 +7130,7 @@ export {
7077
7130
  louvain,
7078
7131
  communityCohesion,
7079
7132
  extractIssuePage,
7133
+ extractGitTree,
7080
7134
  runLinks,
7081
7135
  extractTaxonomy,
7082
7136
  taxonomyCommentForPage,
package/dist/cli.js CHANGED
@@ -50,7 +50,7 @@ import {
50
50
  snapshotterHealthChecks,
51
51
  upsertIndexEntry,
52
52
  vectorIndexStatus
53
- } from "./chunk-MKZKMSYM.js";
53
+ } from "./chunk-JTAZUR2W.js";
54
54
  import {
55
55
  normalizeDistTag,
56
56
  readCache,
@@ -79,6 +79,7 @@ import {
79
79
  collectClaimedTranscripts,
80
80
  defaultLintRunner,
81
81
  extractBodyWikilinks,
82
+ extractGitTree,
82
83
  extractIssuePage,
83
84
  extractTaxonomy,
84
85
  getCliSessionId,
@@ -145,7 +146,7 @@ import {
145
146
  supersedeStaleReviewRequiredJournals,
146
147
  taxonomyCommentForPage,
147
148
  writeDotenv
148
- } from "./chunk-EUTNN4RN.js";
149
+ } from "./chunk-VRK5DOC5.js";
149
150
  import {
150
151
  assertTargetInsideVault,
151
152
  atomicWriteText,
@@ -549,16 +550,7 @@ async function runEval(input) {
549
550
  }
550
551
  const tmpRoot = mkdtempSync(join2(tmpdir(), "skillwiki-eval-delta-"));
551
552
  try {
552
- const archive = execFileSync("git", ["archive", "--format=tar", baseRef], {
553
- cwd: vaultPath,
554
- stdio: ["pipe", "pipe", "pipe"],
555
- maxBuffer: 256 * 1024 * 1024
556
- });
557
- execFileSync("tar", ["-xf", "-"], {
558
- cwd: tmpRoot,
559
- input: archive,
560
- stdio: ["pipe", "pipe", "pipe"]
561
- });
553
+ extractGitTree(vaultPath, baseRef, tmpRoot);
562
554
  const baseAggRes = await aggregateVault(tmpRoot, topLimit);
563
555
  if (!baseAggRes.ok) {
564
556
  return {
@@ -10076,7 +10068,7 @@ async function emitManagedVaultWrite(vault, command, mutate, opts) {
10076
10068
  if (dirty) {
10077
10069
  return emit(dirty, void 0, { postCommit: false });
10078
10070
  }
10079
- const { runManagedWriteTransaction: runManagedWriteTransaction2 } = await import("./managed-write-preflight-SJDRNJSU.js");
10071
+ const { runManagedWriteTransaction: runManagedWriteTransaction2 } = await import("./managed-write-preflight-WIW5L22Q.js");
10080
10072
  const run = await runManagedWriteTransaction2({
10081
10073
  vault,
10082
10074
  command,
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  runManagedWritePreflight,
4
4
  runManagedWriteTransaction
5
- } from "./chunk-EUTNN4RN.js";
5
+ } from "./chunk-VRK5DOC5.js";
6
6
  import "./chunk-74OSLCXE.js";
7
7
  import "./chunk-GAHMWLWU.js";
8
8
  import "./chunk-IJ7DD7QZ.js";
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runSkillwikiMcpStdio
4
- } from "./chunk-MKZKMSYM.js";
4
+ } from "./chunk-JTAZUR2W.js";
5
5
  import "./chunk-7I2TPIV5.js";
6
6
  import "./chunk-O3HCB7R2.js";
7
- import "./chunk-EUTNN4RN.js";
7
+ import "./chunk-VRK5DOC5.js";
8
8
  import "./chunk-74OSLCXE.js";
9
9
  import "./chunk-HBQTTYXZ.js";
10
10
  import "./chunk-GAHMWLWU.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skillwiki",
3
- "version": "0.10.50",
3
+ "version": "0.10.52",
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.10.50",
3
+ "version": "0.10.52",
4
4
  "skills": "./",
5
5
  "description": "Project-aware Karpathy-style knowledge base for Claude Code: 20 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.10.50",
3
+ "version": "0.10.52",
4
4
  "description": "Project-aware Karpathy-style knowledge base for Codex with 20 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.10.50",
3
+ "version": "0.10.52",
4
4
  "private": true,
5
5
  "files": [
6
6
  "wiki-*",