skillwiki 0.10.52 → 0.10.53
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-JTAZUR2W.js → chunk-NPHWECWR.js} +152 -65
- package/dist/{chunk-VRK5DOC5.js → chunk-TZXWZ75D.js} +85 -23
- package/dist/cli.js +6 -5
- package/dist/managed-write-preflight-SERVDSY6.js +20 -0
- package/dist/skillwiki-mcp.js +2 -2
- package/package.json +1 -1
- package/skills/.claude-plugin/plugin.json +1 -1
- package/skills/.codex-plugin/plugin.json +1 -1
- package/skills/package.json +1 -1
- package/dist/managed-write-preflight-WIW5L22Q.js +0 -12
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
snapshotterAliasForLocalHost,
|
|
36
36
|
toUndirectedWeighted,
|
|
37
37
|
writeDotenv
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-TZXWZ75D.js";
|
|
39
39
|
import {
|
|
40
40
|
atomicWriteText,
|
|
41
41
|
prepareTypedPage
|
|
@@ -2673,6 +2673,30 @@ import { existsSync as existsSync12, readFileSync as readFileSync7 } from "fs";
|
|
|
2673
2673
|
import { join as join15 } from "path";
|
|
2674
2674
|
import { execSync as execSync5 } from "child_process";
|
|
2675
2675
|
import { platform as platform3 } from "os";
|
|
2676
|
+
function readPushResultState(stateFile) {
|
|
2677
|
+
if (!existsSync12(stateFile)) return { exists: false };
|
|
2678
|
+
try {
|
|
2679
|
+
const content = readFileSync7(stateFile, "utf8");
|
|
2680
|
+
let result;
|
|
2681
|
+
let reason;
|
|
2682
|
+
let timestamp;
|
|
2683
|
+
for (const line of content.split(/\r?\n/)) {
|
|
2684
|
+
const trimmed = line.trim();
|
|
2685
|
+
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
2686
|
+
const eq = trimmed.indexOf("=");
|
|
2687
|
+
if (eq <= 0) continue;
|
|
2688
|
+
const k = trimmed.slice(0, eq).trim();
|
|
2689
|
+
const v = trimmed.slice(eq + 1).trim();
|
|
2690
|
+
if (k === "result") result = v;
|
|
2691
|
+
else if (k === "reason") reason = v;
|
|
2692
|
+
else if (k === "timestamp") timestamp = v;
|
|
2693
|
+
}
|
|
2694
|
+
const malformed = result !== "ok" && result !== "refused";
|
|
2695
|
+
return { exists: true, result, reason, timestamp, malformed };
|
|
2696
|
+
} catch {
|
|
2697
|
+
return { exists: true, malformed: true };
|
|
2698
|
+
}
|
|
2699
|
+
}
|
|
2676
2700
|
function readVaultSyncConfig(home) {
|
|
2677
2701
|
try {
|
|
2678
2702
|
const content = readFileSync7(join15(home, ".skillwiki", ".env"), "utf8");
|
|
@@ -2749,6 +2773,86 @@ function ageMinutes(nowMs, tsMs) {
|
|
|
2749
2773
|
if (tsMs == null) return null;
|
|
2750
2774
|
return Math.floor((nowMs - tsMs) / 6e4);
|
|
2751
2775
|
}
|
|
2776
|
+
function checkPushAgeFromTimestamp(ts) {
|
|
2777
|
+
const lastPush = new Date(ts).getTime();
|
|
2778
|
+
if (isNaN(lastPush)) {
|
|
2779
|
+
return check(
|
|
2780
|
+
"warn",
|
|
2781
|
+
"vault_sync_last_push_age",
|
|
2782
|
+
"Vault sync last push recency",
|
|
2783
|
+
`Unparseable push timestamp: ${ts}`
|
|
2784
|
+
);
|
|
2785
|
+
}
|
|
2786
|
+
const ageSec = (Date.now() - lastPush) / 1e3;
|
|
2787
|
+
if (ageSec <= 180) {
|
|
2788
|
+
return check(
|
|
2789
|
+
"pass",
|
|
2790
|
+
"vault_sync_last_push_age",
|
|
2791
|
+
"Vault sync last push recency",
|
|
2792
|
+
`Last push ${ageSec.toFixed(0)}s ago`
|
|
2793
|
+
);
|
|
2794
|
+
}
|
|
2795
|
+
return check(
|
|
2796
|
+
"warn",
|
|
2797
|
+
"vault_sync_last_push_age",
|
|
2798
|
+
"Vault sync last push recency",
|
|
2799
|
+
`Last push ${Math.round(ageSec)}s ago (>3 min)`
|
|
2800
|
+
);
|
|
2801
|
+
}
|
|
2802
|
+
function checkPushAgeFromLog(logDir, logFile) {
|
|
2803
|
+
try {
|
|
2804
|
+
const logContent = readFileSync7(logFile, "utf8");
|
|
2805
|
+
const lines = logContent.trim().split("\n").filter(Boolean);
|
|
2806
|
+
if (lines.length === 0) {
|
|
2807
|
+
return check(
|
|
2808
|
+
"warn",
|
|
2809
|
+
"vault_sync_last_push_age",
|
|
2810
|
+
"Vault sync last push recency",
|
|
2811
|
+
"Log file is empty"
|
|
2812
|
+
);
|
|
2813
|
+
}
|
|
2814
|
+
const journalRe = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z) (OK push|FAIL)/;
|
|
2815
|
+
let lastLine;
|
|
2816
|
+
let match = null;
|
|
2817
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
2818
|
+
match = lines[i].match(journalRe);
|
|
2819
|
+
if (match) {
|
|
2820
|
+
lastLine = lines[i];
|
|
2821
|
+
break;
|
|
2822
|
+
}
|
|
2823
|
+
}
|
|
2824
|
+
if (!lastLine || !match) {
|
|
2825
|
+
const tail = lines[lines.length - 1];
|
|
2826
|
+
return check(
|
|
2827
|
+
"warn",
|
|
2828
|
+
"vault_sync_last_push_age",
|
|
2829
|
+
"Vault sync last push recency",
|
|
2830
|
+
`Last log entry: ${tail.slice(0, 80)}`
|
|
2831
|
+
);
|
|
2832
|
+
}
|
|
2833
|
+
if (match[2] === "FAIL") {
|
|
2834
|
+
return check(
|
|
2835
|
+
"error",
|
|
2836
|
+
"vault_sync_last_push_age",
|
|
2837
|
+
"Vault sync last push recency",
|
|
2838
|
+
`Last push failed: ${lastLine}`
|
|
2839
|
+
);
|
|
2840
|
+
}
|
|
2841
|
+
return checkPushAgeFromTimestamp(match[1]);
|
|
2842
|
+
} catch {
|
|
2843
|
+
return existsSync12(logDir) ? check(
|
|
2844
|
+
"warn",
|
|
2845
|
+
"vault_sync_last_push_age",
|
|
2846
|
+
"Vault sync last push recency",
|
|
2847
|
+
`Log file not found at ${logFile}`
|
|
2848
|
+
) : check(
|
|
2849
|
+
"error",
|
|
2850
|
+
"vault_sync_last_push_age",
|
|
2851
|
+
"Vault sync last push recency",
|
|
2852
|
+
`Log directory not found at ${logDir}`
|
|
2853
|
+
);
|
|
2854
|
+
}
|
|
2855
|
+
}
|
|
2752
2856
|
function snapshotterHealthChecks(scope, logDir, env) {
|
|
2753
2857
|
const fixture = loadSnapshotFixture(env);
|
|
2754
2858
|
const cadence = fixture ? fixture.cadence_minutes : parseInt(env.VS_SNAPSHOT_CADENCE_MINUTES ?? "30", 10) || 30;
|
|
@@ -2861,6 +2965,7 @@ function vaultSyncChecks(input) {
|
|
|
2861
2965
|
skip("vault_sync_jobs_enabled", "Vault sync jobs enabled"),
|
|
2862
2966
|
skip("vault_sync_snapshot_service_result", "Vault sync snapshot service result"),
|
|
2863
2967
|
skip("vault_sync_last_push_age", "Vault sync last push recency"),
|
|
2968
|
+
skip("vault_sync_last_push_result", "Vault sync last push result"),
|
|
2864
2969
|
skip("vault_sync_snapshot_consecutive_failures", "Vault sync snapshot consecutive failures"),
|
|
2865
2970
|
skip("vault_sync_last_fetch_status", "Vault sync last fetch status"),
|
|
2866
2971
|
skip("vault_sync_filter_present", "Vault sync filter file present"),
|
|
@@ -2869,6 +2974,7 @@ function vaultSyncChecks(input) {
|
|
|
2869
2974
|
}
|
|
2870
2975
|
const isMac = os === "darwin";
|
|
2871
2976
|
const logDir = input.logDir ?? (isMac ? join15(home, "Library", "Logs") : join15(home, ".local", "state", "vault-sync", "log"));
|
|
2977
|
+
const cacheDir = input.cacheDir ?? (isMac ? join15(home, "Library", "Caches", "vault-sync") : join15(home, ".cache", "vault-sync"));
|
|
2872
2978
|
const shareDir = input.shareDir ?? (isMac ? join15(home, "Library", "Application Support", "vault-sync", "bin") : join15(home, ".local", "share", "vault-sync", "bin"));
|
|
2873
2979
|
const filterPath = input.filterPath ?? join15(home, ".config", "rclone", "wiki-push-filters.txt");
|
|
2874
2980
|
const packagedSnapshotPath = join15(shareDir, "wiki-snapshot.sh");
|
|
@@ -2979,75 +3085,56 @@ function vaultSyncChecks(input) {
|
|
|
2979
3085
|
"Scheduler check failed \u2014 run vault-sync-install"
|
|
2980
3086
|
);
|
|
2981
3087
|
}
|
|
3088
|
+
const stateFile = join15(cacheDir, "wiki-push-result.state");
|
|
3089
|
+
const pushState = readPushResultState(stateFile);
|
|
2982
3090
|
const logFile = join15(logDir, "wiki-push.log");
|
|
2983
3091
|
let c3;
|
|
2984
|
-
|
|
2985
|
-
const
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
c3 = check(
|
|
2989
|
-
"warn",
|
|
2990
|
-
"vault_sync_last_push_age",
|
|
2991
|
-
"Vault sync last push recency",
|
|
2992
|
-
"Log file is empty"
|
|
2993
|
-
);
|
|
2994
|
-
} else {
|
|
2995
|
-
const lastLine = [...lines].reverse().find((line) => /FAIL|OK push/.test(line)) ?? lines[lines.length - 1];
|
|
2996
|
-
if (/FAIL/.test(lastLine)) {
|
|
2997
|
-
c3 = check(
|
|
2998
|
-
"error",
|
|
2999
|
-
"vault_sync_last_push_age",
|
|
3000
|
-
"Vault sync last push recency",
|
|
3001
|
-
`Last push failed: ${lastLine}`
|
|
3002
|
-
);
|
|
3003
|
-
} else if (/OK push/.test(lastLine)) {
|
|
3004
|
-
const tsMatch = lastLine.match(/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z)/);
|
|
3005
|
-
if (tsMatch) {
|
|
3006
|
-
const lastPush = new Date(tsMatch[1]).getTime();
|
|
3007
|
-
const ageSec = (Date.now() - lastPush) / 1e3;
|
|
3008
|
-
if (ageSec <= 180) {
|
|
3009
|
-
c3 = check(
|
|
3010
|
-
"pass",
|
|
3011
|
-
"vault_sync_last_push_age",
|
|
3012
|
-
"Vault sync last push recency",
|
|
3013
|
-
`Last push ${ageSec.toFixed(0)}s ago`
|
|
3014
|
-
);
|
|
3015
|
-
} else {
|
|
3016
|
-
c3 = check(
|
|
3017
|
-
"warn",
|
|
3018
|
-
"vault_sync_last_push_age",
|
|
3019
|
-
"Vault sync last push recency",
|
|
3020
|
-
`Last push ${Math.round(ageSec)}s ago (>3 min)`
|
|
3021
|
-
);
|
|
3022
|
-
}
|
|
3023
|
-
} else {
|
|
3024
|
-
c3 = check(
|
|
3025
|
-
"warn",
|
|
3026
|
-
"vault_sync_last_push_age",
|
|
3027
|
-
"Vault sync last push recency",
|
|
3028
|
-
`Unparseable push line: ${lastLine.slice(0, 80)}`
|
|
3029
|
-
);
|
|
3030
|
-
}
|
|
3031
|
-
} else {
|
|
3032
|
-
c3 = check(
|
|
3033
|
-
"warn",
|
|
3034
|
-
"vault_sync_last_push_age",
|
|
3035
|
-
"Vault sync last push recency",
|
|
3036
|
-
`Last log entry: ${lastLine.slice(0, 80)}`
|
|
3037
|
-
);
|
|
3038
|
-
}
|
|
3039
|
-
}
|
|
3040
|
-
} catch {
|
|
3041
|
-
c3 = existsSync12(logDir) ? check(
|
|
3042
|
-
"warn",
|
|
3092
|
+
if (pushState.exists && !pushState.malformed && pushState.result === "refused") {
|
|
3093
|
+
const reasonSuffix = pushState.reason ? `: ${pushState.reason}` : "";
|
|
3094
|
+
c3 = check(
|
|
3095
|
+
"error",
|
|
3043
3096
|
"vault_sync_last_push_age",
|
|
3044
3097
|
"Vault sync last push recency",
|
|
3045
|
-
`
|
|
3046
|
-
)
|
|
3047
|
-
|
|
3098
|
+
`Last push refused${reasonSuffix}`
|
|
3099
|
+
);
|
|
3100
|
+
} else if (pushState.exists && !pushState.malformed && pushState.result === "ok") {
|
|
3101
|
+
c3 = pushState.timestamp ? checkPushAgeFromTimestamp(pushState.timestamp) : check(
|
|
3102
|
+
"warn",
|
|
3048
3103
|
"vault_sync_last_push_age",
|
|
3049
3104
|
"Vault sync last push recency",
|
|
3050
|
-
|
|
3105
|
+
"State file missing timestamp"
|
|
3106
|
+
);
|
|
3107
|
+
} else {
|
|
3108
|
+
c3 = checkPushAgeFromLog(logDir, logFile);
|
|
3109
|
+
}
|
|
3110
|
+
let cPushResult;
|
|
3111
|
+
if (!pushState.exists) {
|
|
3112
|
+
cPushResult = check(
|
|
3113
|
+
"warn",
|
|
3114
|
+
"vault_sync_last_push_result",
|
|
3115
|
+
"Vault sync last push result",
|
|
3116
|
+
`no push result state file (push may not have run yet): ${stateFile}`
|
|
3117
|
+
);
|
|
3118
|
+
} else if (pushState.malformed) {
|
|
3119
|
+
cPushResult = check(
|
|
3120
|
+
"warn",
|
|
3121
|
+
"vault_sync_last_push_result",
|
|
3122
|
+
"Vault sync last push result",
|
|
3123
|
+
`malformed state file: ${stateFile}`
|
|
3124
|
+
);
|
|
3125
|
+
} else if (pushState.result === "ok") {
|
|
3126
|
+
cPushResult = check(
|
|
3127
|
+
"pass",
|
|
3128
|
+
"vault_sync_last_push_result",
|
|
3129
|
+
"Vault sync last push result",
|
|
3130
|
+
`result=ok timestamp=${pushState.timestamp ?? ""}`
|
|
3131
|
+
);
|
|
3132
|
+
} else {
|
|
3133
|
+
cPushResult = check(
|
|
3134
|
+
"error",
|
|
3135
|
+
"vault_sync_last_push_result",
|
|
3136
|
+
"Vault sync last push result",
|
|
3137
|
+
`result=refused reason=${pushState.reason ?? ""} timestamp=${pushState.timestamp ?? ""}`
|
|
3051
3138
|
);
|
|
3052
3139
|
}
|
|
3053
3140
|
const fetchLogFile = join15(logDir, "wiki-fetch.log");
|
|
@@ -3182,7 +3269,7 @@ function vaultSyncChecks(input) {
|
|
|
3182
3269
|
);
|
|
3183
3270
|
}
|
|
3184
3271
|
}
|
|
3185
|
-
return [c1, c2, c3, cFetch, c4, c5];
|
|
3272
|
+
return [c1, c2, c3, cPushResult, cFetch, c4, c5];
|
|
3186
3273
|
}
|
|
3187
3274
|
function checkVaultSyncPullHelper(home, env) {
|
|
3188
3275
|
const path = resolveVaultSyncPullHelper({
|
|
@@ -6715,10 +6715,25 @@ function resolveConfiguredSnapshotWorktree(home) {
|
|
|
6715
6715
|
}
|
|
6716
6716
|
|
|
6717
6717
|
// src/utils/managed-write-preflight.ts
|
|
6718
|
+
var DEFAULT_MANAGED_WRITE_WAIT_MS = 24e4;
|
|
6719
|
+
var MANAGED_WRITE_POLL_INTERVAL_MS = 2e3;
|
|
6720
|
+
function resolveManagedWriteWaitMs(env) {
|
|
6721
|
+
const raw = env?.SKILLWIKI_MANAGED_WRITE_WAIT_MS ?? process.env.SKILLWIKI_MANAGED_WRITE_WAIT_MS;
|
|
6722
|
+
if (!raw) return DEFAULT_MANAGED_WRITE_WAIT_MS;
|
|
6723
|
+
const parsed = Number.parseInt(raw, 10);
|
|
6724
|
+
if (!Number.isFinite(parsed) || parsed <= 0) return DEFAULT_MANAGED_WRITE_WAIT_MS;
|
|
6725
|
+
return parsed;
|
|
6726
|
+
}
|
|
6718
6727
|
var DEFAULT_DEPS = {
|
|
6719
6728
|
converge: (input) => runVaultSyncPullHelper(input),
|
|
6720
6729
|
resolveConfiguredSnapshotWorktree,
|
|
6721
|
-
syncPeers: runSyncPeers
|
|
6730
|
+
syncPeers: runSyncPeers,
|
|
6731
|
+
sleepMs: (ms) => new Promise((resolve7) => setTimeout(resolve7, ms)),
|
|
6732
|
+
nowMs: () => Date.now(),
|
|
6733
|
+
logHeartbeat: (message) => {
|
|
6734
|
+
process.stderr.write(`${message}
|
|
6735
|
+
`);
|
|
6736
|
+
}
|
|
6722
6737
|
};
|
|
6723
6738
|
var SAFE_MANAGED_WRITER_KINDS = new Set(MANAGED_WRITER_KINDS);
|
|
6724
6739
|
var SAFE_STASH_AUDIT_CLASSIFICATIONS = new Set(STASH_AUDIT_CLASSIFICATIONS);
|
|
@@ -6791,48 +6806,91 @@ function peerCheckFailure(reason, detail = {}) {
|
|
|
6791
6806
|
result: err("PREFLIGHT_FAILED", { reason, ...detail })
|
|
6792
6807
|
};
|
|
6793
6808
|
}
|
|
6794
|
-
function
|
|
6809
|
+
function evaluateManagedWritePeerGate(vault, mode, deps) {
|
|
6795
6810
|
try {
|
|
6796
6811
|
const check = (deps.syncPeers ?? DEFAULT_DEPS.syncPeers)({ vault });
|
|
6797
6812
|
if (check.exitCode !== ExitCode.OK || !check.result.ok) {
|
|
6798
|
-
return peerCheckFailure("peer-check-failed");
|
|
6813
|
+
return { status: "block", failure: peerCheckFailure("peer-check-failed") };
|
|
6799
6814
|
}
|
|
6800
6815
|
const validated = validateSyncPeersOutput(check.result.data);
|
|
6801
6816
|
if (!validated) {
|
|
6802
|
-
return peerCheckFailure("peer-check-failed");
|
|
6817
|
+
return { status: "block", failure: peerCheckFailure("peer-check-failed") };
|
|
6803
6818
|
}
|
|
6804
6819
|
const { output: peerOutput, foreignLockCount, recentPeerStashCount } = validated;
|
|
6805
6820
|
const nonWriterBlockingSignal = foreignLockCount > 0 || recentPeerStashCount > 0;
|
|
6806
6821
|
const writerOnly = peerOutput.managed_writers.blocking && !nonWriterBlockingSignal;
|
|
6807
|
-
if (mode !== "git-writer" && writerOnly) return
|
|
6822
|
+
if (mode !== "git-writer" && writerOnly) return { status: "pass" };
|
|
6808
6823
|
const managedWriterBlocking = mode === "git-writer" && peerOutput.managed_writers.blocking;
|
|
6809
6824
|
const hasKnownBlockingSignal = foreignLockCount > 0 || managedWriterBlocking || recentPeerStashCount > 0;
|
|
6810
6825
|
if (!peerOutput.blocking) {
|
|
6811
|
-
return hasKnownBlockingSignal ? peerCheckFailure("peer-check-failed") :
|
|
6826
|
+
return hasKnownBlockingSignal ? { status: "block", failure: peerCheckFailure("peer-check-failed") } : { status: "pass" };
|
|
6812
6827
|
}
|
|
6813
6828
|
if (managedWriterBlocking) {
|
|
6814
|
-
return
|
|
6815
|
-
|
|
6816
|
-
|
|
6817
|
-
|
|
6818
|
-
}
|
|
6829
|
+
return {
|
|
6830
|
+
status: "overlap",
|
|
6831
|
+
count: peerOutput.managed_writers.count,
|
|
6832
|
+
kinds: peerOutput.managed_writers.kinds.slice(0, 8)
|
|
6833
|
+
};
|
|
6819
6834
|
}
|
|
6820
6835
|
if (foreignLockCount > 0) {
|
|
6821
|
-
return
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
6836
|
+
return {
|
|
6837
|
+
status: "block",
|
|
6838
|
+
failure: peerCheckFailure("peer-lock", {
|
|
6839
|
+
foreign_lock_count: foreignLockCount,
|
|
6840
|
+
blocking: true
|
|
6841
|
+
})
|
|
6842
|
+
};
|
|
6825
6843
|
}
|
|
6826
6844
|
if (recentPeerStashCount > 0) {
|
|
6827
|
-
return
|
|
6828
|
-
|
|
6829
|
-
|
|
6830
|
-
|
|
6831
|
-
|
|
6845
|
+
return {
|
|
6846
|
+
status: "block",
|
|
6847
|
+
failure: peerCheckFailure("recent-peer-stash", {
|
|
6848
|
+
recent_peer_stash_count: recentPeerStashCount,
|
|
6849
|
+
stash_classification: "recent_known_peer_stash",
|
|
6850
|
+
blocking: true
|
|
6851
|
+
})
|
|
6852
|
+
};
|
|
6832
6853
|
}
|
|
6833
|
-
return
|
|
6854
|
+
return {
|
|
6855
|
+
status: "block",
|
|
6856
|
+
failure: peerCheckFailure("peer-blocked", { blocking: true })
|
|
6857
|
+
};
|
|
6834
6858
|
} catch {
|
|
6835
|
-
return peerCheckFailure("peer-check-failed");
|
|
6859
|
+
return { status: "block", failure: peerCheckFailure("peer-check-failed") };
|
|
6860
|
+
}
|
|
6861
|
+
}
|
|
6862
|
+
async function runManagedWritePeerGate(vault, mode, deps = DEFAULT_DEPS, env) {
|
|
6863
|
+
const now = deps.nowMs ?? DEFAULT_DEPS.nowMs;
|
|
6864
|
+
const sleep = deps.sleepMs ?? DEFAULT_DEPS.sleepMs;
|
|
6865
|
+
const logHeartbeat = deps.logHeartbeat ?? DEFAULT_DEPS.logHeartbeat;
|
|
6866
|
+
const waitMs = resolveManagedWriteWaitMs(env);
|
|
6867
|
+
const initial = evaluateManagedWritePeerGate(vault, mode, deps);
|
|
6868
|
+
if (initial.status === "pass") return null;
|
|
6869
|
+
if (initial.status === "block") return initial.failure;
|
|
6870
|
+
const startedAt = now();
|
|
6871
|
+
const deadline = startedAt + waitMs;
|
|
6872
|
+
let lastOverlap = initial;
|
|
6873
|
+
for (; ; ) {
|
|
6874
|
+
const t = now();
|
|
6875
|
+
const elapsed = Math.max(0, t - startedAt);
|
|
6876
|
+
const remainingMs = Math.max(0, deadline - t);
|
|
6877
|
+
const remainingSec = Math.ceil(remainingMs / 1e3);
|
|
6878
|
+
const writerKindDesc = lastOverlap.kinds.length > 0 ? lastOverlap.kinds.join(", ") : "unknown";
|
|
6879
|
+
logHeartbeat(`skillwiki: waiting for live vault writer (${writerKindDesc}), ${remainingSec}s left`);
|
|
6880
|
+
if (t >= deadline) {
|
|
6881
|
+
return peerCheckFailure("live-writer-overlap", {
|
|
6882
|
+
managed_writer_count: lastOverlap.count,
|
|
6883
|
+
managed_writer_kinds: lastOverlap.kinds,
|
|
6884
|
+
blocking: true,
|
|
6885
|
+
waited_ms: elapsed
|
|
6886
|
+
});
|
|
6887
|
+
}
|
|
6888
|
+
const nextSleepMs = Math.min(MANAGED_WRITE_POLL_INTERVAL_MS, remainingMs);
|
|
6889
|
+
await sleep(nextSleepMs);
|
|
6890
|
+
const check = evaluateManagedWritePeerGate(vault, mode, deps);
|
|
6891
|
+
if (check.status === "pass") return null;
|
|
6892
|
+
if (check.status === "block") return check.failure;
|
|
6893
|
+
lastOverlap = check;
|
|
6836
6894
|
}
|
|
6837
6895
|
}
|
|
6838
6896
|
function preflightBlocker(vault) {
|
|
@@ -7108,7 +7166,7 @@ async function runManagedWriteTransaction(input, deps = DEFAULT_DEPS) {
|
|
|
7108
7166
|
})
|
|
7109
7167
|
};
|
|
7110
7168
|
}
|
|
7111
|
-
const peerGate = runManagedWritePeerGate(mutationVault, receipt.mode, deps);
|
|
7169
|
+
const peerGate = await runManagedWritePeerGate(mutationVault, receipt.mode, deps, input.env);
|
|
7112
7170
|
if (peerGate) return peerGate;
|
|
7113
7171
|
return await input.mutate(receipt);
|
|
7114
7172
|
} finally {
|
|
@@ -7208,6 +7266,10 @@ export {
|
|
|
7208
7266
|
markJournalSuperseded,
|
|
7209
7267
|
supersedeStaleReviewRequiredJournals,
|
|
7210
7268
|
resolveConfiguredSnapshotWorktree,
|
|
7269
|
+
DEFAULT_MANAGED_WRITE_WAIT_MS,
|
|
7270
|
+
MANAGED_WRITE_POLL_INTERVAL_MS,
|
|
7271
|
+
resolveManagedWriteWaitMs,
|
|
7272
|
+
runManagedWritePeerGate,
|
|
7211
7273
|
runManagedWritePreflight,
|
|
7212
7274
|
runManagedWriteTransaction
|
|
7213
7275
|
};
|
package/dist/cli.js
CHANGED
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
snapshotterHealthChecks,
|
|
51
51
|
upsertIndexEntry,
|
|
52
52
|
vectorIndexStatus
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-NPHWECWR.js";
|
|
54
54
|
import {
|
|
55
55
|
normalizeDistTag,
|
|
56
56
|
readCache,
|
|
@@ -146,7 +146,7 @@ import {
|
|
|
146
146
|
supersedeStaleReviewRequiredJournals,
|
|
147
147
|
taxonomyCommentForPage,
|
|
148
148
|
writeDotenv
|
|
149
|
-
} from "./chunk-
|
|
149
|
+
} from "./chunk-TZXWZ75D.js";
|
|
150
150
|
import {
|
|
151
151
|
assertTargetInsideVault,
|
|
152
152
|
atomicWriteText,
|
|
@@ -3041,11 +3041,12 @@ function classifyLog(path, id, label, okPattern) {
|
|
|
3041
3041
|
if (!existsSync6(path)) return { id, label, status: "warn", detail: `log file missing: ${path}` };
|
|
3042
3042
|
const lines = readFileSync10(path, "utf8").split(/\r?\n/).filter(Boolean);
|
|
3043
3043
|
if (lines.length === 0) return { id, label, status: "warn", detail: `log file empty: ${path}` };
|
|
3044
|
+
const journalFailRe = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z (FAIL|ERROR)\b/;
|
|
3044
3045
|
const statusLine = [...lines].reverse().find(
|
|
3045
|
-
(line) => /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z /.test(line) && (okPattern.test(line) ||
|
|
3046
|
+
(line) => /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z /.test(line) && (okPattern.test(line) || journalFailRe.test(line))
|
|
3046
3047
|
);
|
|
3047
3048
|
const last = statusLine ?? lines[lines.length - 1];
|
|
3048
|
-
if (
|
|
3049
|
+
if (journalFailRe.test(last)) return { id, label, status: "error", detail: last.slice(0, 120) };
|
|
3049
3050
|
if (okPattern.test(last)) return { id, label, status: "pass", detail: last.slice(0, 120) };
|
|
3050
3051
|
return { id, label, status: "warn", detail: last.slice(0, 120) };
|
|
3051
3052
|
}
|
|
@@ -10068,7 +10069,7 @@ async function emitManagedVaultWrite(vault, command, mutate, opts) {
|
|
|
10068
10069
|
if (dirty) {
|
|
10069
10070
|
return emit(dirty, void 0, { postCommit: false });
|
|
10070
10071
|
}
|
|
10071
|
-
const { runManagedWriteTransaction: runManagedWriteTransaction2 } = await import("./managed-write-preflight-
|
|
10072
|
+
const { runManagedWriteTransaction: runManagedWriteTransaction2 } = await import("./managed-write-preflight-SERVDSY6.js");
|
|
10072
10073
|
const run = await runManagedWriteTransaction2({
|
|
10073
10074
|
vault,
|
|
10074
10075
|
command,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
DEFAULT_MANAGED_WRITE_WAIT_MS,
|
|
4
|
+
MANAGED_WRITE_POLL_INTERVAL_MS,
|
|
5
|
+
resolveManagedWriteWaitMs,
|
|
6
|
+
runManagedWritePeerGate,
|
|
7
|
+
runManagedWritePreflight,
|
|
8
|
+
runManagedWriteTransaction
|
|
9
|
+
} from "./chunk-TZXWZ75D.js";
|
|
10
|
+
import "./chunk-74OSLCXE.js";
|
|
11
|
+
import "./chunk-GAHMWLWU.js";
|
|
12
|
+
import "./chunk-IJ7DD7QZ.js";
|
|
13
|
+
export {
|
|
14
|
+
DEFAULT_MANAGED_WRITE_WAIT_MS,
|
|
15
|
+
MANAGED_WRITE_POLL_INTERVAL_MS,
|
|
16
|
+
resolveManagedWriteWaitMs,
|
|
17
|
+
runManagedWritePeerGate,
|
|
18
|
+
runManagedWritePreflight,
|
|
19
|
+
runManagedWriteTransaction
|
|
20
|
+
};
|
package/dist/skillwiki-mcp.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
runSkillwikiMcpStdio
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NPHWECWR.js";
|
|
5
5
|
import "./chunk-7I2TPIV5.js";
|
|
6
6
|
import "./chunk-O3HCB7R2.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-TZXWZ75D.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.
|
|
3
|
+
"version": "0.10.53",
|
|
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": {
|
package/skills/package.json
CHANGED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
runManagedWritePreflight,
|
|
4
|
-
runManagedWriteTransaction
|
|
5
|
-
} from "./chunk-VRK5DOC5.js";
|
|
6
|
-
import "./chunk-74OSLCXE.js";
|
|
7
|
-
import "./chunk-GAHMWLWU.js";
|
|
8
|
-
import "./chunk-IJ7DD7QZ.js";
|
|
9
|
-
export {
|
|
10
|
-
runManagedWritePreflight,
|
|
11
|
-
runManagedWriteTransaction
|
|
12
|
-
};
|