skillwiki 0.10.110 → 0.10.112
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-25OXNFDV.js +133 -0
- package/dist/{chunk-R2DJ7IJ5.js → chunk-7POLZOFY.js} +44 -375
- package/dist/chunk-ABRYBO4T.js +275 -0
- package/dist/{chunk-6X6PPQNI.js → chunk-APKDTEVV.js} +280 -446
- package/dist/{chunk-5MV5SSRM.js → chunk-CKQPUHM2.js} +5 -3
- package/dist/chunk-DOHWNPAZ.js +60 -0
- package/dist/chunk-EE7W3GLA.js +55 -0
- package/dist/chunk-FCA3RRNF.js +60 -0
- package/dist/{chunk-KX5Y3GSX.js → chunk-IR2DI4Y5.js} +5 -3
- package/dist/chunk-K3M6OSUW.js +77 -0
- package/dist/{chunk-WPJHDRTP.js → chunk-KJG2CSYD.js} +12 -57
- package/dist/chunk-LOVLZNLX.js +111 -0
- package/dist/chunk-OSL4J7GF.js +32 -0
- package/dist/{chunk-QU2CKXM4.js → chunk-Q6EZF37H.js} +91 -199
- package/dist/chunk-QESNTTVY.js +50 -0
- package/dist/{chunk-NA3TZ4JN.js → chunk-RR6VDWSI.js} +8 -6
- package/dist/chunk-SKOLE6US.js +126 -0
- package/dist/chunk-TKX6PSWZ.js +344 -0
- package/dist/chunk-ZRGZBAVS.js +98 -0
- package/dist/cli.js +359 -305
- package/dist/{index-projection-6XGESSHV.js → index-projection-UNZG5UJZ.js} +5 -3
- package/dist/journal-5IW3TZ5F.js +13 -0
- package/dist/{managed-write-preflight-JPOBVVSU.js → managed-write-preflight-L7IRQ76C.js} +7 -4
- package/dist/mcp-auth-env-X5MI5IX6.js +25 -0
- package/dist/migrate-RO4BJP5T.js +22 -0
- package/dist/mirror-H5BTBAON.js +151 -0
- package/dist/ready-S7F53Q2D.js +9 -0
- package/dist/runtime-VMFYW2K3.js +20 -0
- package/dist/skillwiki-mcp.js +14 -7
- package/dist/sources-AOYP6ROO.js +10 -0
- package/dist/upload-HTE62TOV.js +14 -0
- package/dist/watcher-MGHQD3UI.js +526 -0
- package/docs/clip-outbox.md +119 -0
- package/package.json +5 -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-init/SKILL.md +3 -0
- package/skills/using-skillwiki/SKILL.md +1 -1
- package/skills/wiki-init/SKILL.md +3 -0
- package/templates/launchd/com.karlchow.skillwiki-clip-outbox.plist +12 -13
- package/templates/launchd/com.karlchow.skillwiki-mirror-sse.plist +20 -0
- package/dist/sources-CLOF5VAT.js +0 -9
|
@@ -4,9 +4,11 @@ import {
|
|
|
4
4
|
UNMANAGED_START,
|
|
5
5
|
renderRootIndex,
|
|
6
6
|
writeRootIndexProjection
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-IR2DI4Y5.js";
|
|
8
|
+
import "./chunk-KJG2CSYD.js";
|
|
9
|
+
import "./chunk-TKX6PSWZ.js";
|
|
10
|
+
import "./chunk-EE7W3GLA.js";
|
|
11
|
+
import "./chunk-7POLZOFY.js";
|
|
10
12
|
export {
|
|
11
13
|
UNMANAGED_END,
|
|
12
14
|
UNMANAGED_START,
|
|
@@ -6,10 +6,13 @@ import {
|
|
|
6
6
|
runManagedWritePeerGate,
|
|
7
7
|
runManagedWritePreflight,
|
|
8
8
|
runManagedWriteTransaction
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-Q6EZF37H.js";
|
|
10
|
+
import "./chunk-CKQPUHM2.js";
|
|
11
|
+
import "./chunk-KJG2CSYD.js";
|
|
12
|
+
import "./chunk-TKX6PSWZ.js";
|
|
13
|
+
import "./chunk-EE7W3GLA.js";
|
|
14
|
+
import "./chunk-SKOLE6US.js";
|
|
15
|
+
import "./chunk-7POLZOFY.js";
|
|
13
16
|
export {
|
|
14
17
|
DEFAULT_MANAGED_WRITE_WAIT_MS,
|
|
15
18
|
MANAGED_WRITE_POLL_INTERVAL_MS,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
MCP_HOST_ID_ENV,
|
|
4
|
+
MCP_TOKEN_ENV,
|
|
5
|
+
MCP_URL_ENV,
|
|
6
|
+
isMcpOnlyLeaf,
|
|
7
|
+
mcpAuthFromEnv,
|
|
8
|
+
mergeMcpAuthIntoEnv,
|
|
9
|
+
nonEmptyEnvValue,
|
|
10
|
+
redactMcpSecret,
|
|
11
|
+
resolveMcpAuthEnv
|
|
12
|
+
} from "./chunk-DOHWNPAZ.js";
|
|
13
|
+
import "./chunk-SKOLE6US.js";
|
|
14
|
+
import "./chunk-7POLZOFY.js";
|
|
15
|
+
export {
|
|
16
|
+
MCP_HOST_ID_ENV,
|
|
17
|
+
MCP_TOKEN_ENV,
|
|
18
|
+
MCP_URL_ENV,
|
|
19
|
+
isMcpOnlyLeaf,
|
|
20
|
+
mcpAuthFromEnv,
|
|
21
|
+
mergeMcpAuthIntoEnv,
|
|
22
|
+
nonEmptyEnvValue,
|
|
23
|
+
redactMcpSecret,
|
|
24
|
+
resolveMcpAuthEnv
|
|
25
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
CLIP_MIGRATION_HINT,
|
|
4
|
+
migrateClipOutbox,
|
|
5
|
+
packagedPlist,
|
|
6
|
+
refreshInstalledClipPlist,
|
|
7
|
+
stableCliBinary,
|
|
8
|
+
xml
|
|
9
|
+
} from "./chunk-25OXNFDV.js";
|
|
10
|
+
import "./chunk-EE7W3GLA.js";
|
|
11
|
+
import "./chunk-ABRYBO4T.js";
|
|
12
|
+
import "./chunk-LOVLZNLX.js";
|
|
13
|
+
import "./chunk-SKOLE6US.js";
|
|
14
|
+
import "./chunk-7POLZOFY.js";
|
|
15
|
+
export {
|
|
16
|
+
CLIP_MIGRATION_HINT,
|
|
17
|
+
migrateClipOutbox,
|
|
18
|
+
packagedPlist,
|
|
19
|
+
refreshInstalledClipPlist,
|
|
20
|
+
stableCliBinary,
|
|
21
|
+
xml
|
|
22
|
+
};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
writeRegularExclusive
|
|
4
|
+
} from "./chunk-K3M6OSUW.js";
|
|
5
|
+
import {
|
|
6
|
+
parseDestination
|
|
7
|
+
} from "./chunk-ZRGZBAVS.js";
|
|
8
|
+
import "./chunk-QESNTTVY.js";
|
|
9
|
+
|
|
10
|
+
// src/clip-outbox/mirror.ts
|
|
11
|
+
import { mkdir, rmdir } from "fs/promises";
|
|
12
|
+
import { dirname, join } from "path";
|
|
13
|
+
import { GetObjectCommand } from "@aws-sdk/client-s3";
|
|
14
|
+
var ADMIT = /^raw\/(articles|assets)\/[A-Za-z0-9._/-]+$/;
|
|
15
|
+
function admitMirrorPath(path) {
|
|
16
|
+
return ADMIT.test(path) && !path.split("/").some((part) => part === ".." || part === "." || !part);
|
|
17
|
+
}
|
|
18
|
+
function orderMirrorPaths(paths) {
|
|
19
|
+
const unique = [...new Set(paths.filter(admitMirrorPath))];
|
|
20
|
+
return [...unique.filter((path) => path.startsWith("raw/assets/")), ...unique.filter((path) => path.startsWith("raw/articles/"))];
|
|
21
|
+
}
|
|
22
|
+
function eventsUrlFromMcp(mcpUrl) {
|
|
23
|
+
const url = new URL(mcpUrl);
|
|
24
|
+
url.pathname = "/events";
|
|
25
|
+
url.search = "";
|
|
26
|
+
url.hash = "";
|
|
27
|
+
return url.toString();
|
|
28
|
+
}
|
|
29
|
+
function wikiFetchPullLockDir(home) {
|
|
30
|
+
return join(home, "Library", "Caches", "vault-sync", "wiki-fetch", "pull.lock.d");
|
|
31
|
+
}
|
|
32
|
+
async function acquireWikiFetchPullLock(home) {
|
|
33
|
+
const lockDir = wikiFetchPullLockDir(home);
|
|
34
|
+
await mkdir(dirname(lockDir), { recursive: true });
|
|
35
|
+
try {
|
|
36
|
+
await mkdir(lockDir);
|
|
37
|
+
} catch (error) {
|
|
38
|
+
if (error.code === "EEXIST") return null;
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
return async () => {
|
|
42
|
+
await rmdir(lockDir).catch(() => void 0);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function parseChangedSseBlock(block) {
|
|
46
|
+
let event = "message";
|
|
47
|
+
let data = "";
|
|
48
|
+
for (const line of block.split(/\r?\n/)) {
|
|
49
|
+
if (line.startsWith("event:")) event = line.slice(6).trim();
|
|
50
|
+
else if (line.startsWith("data:")) data += line.slice(5).trimStart();
|
|
51
|
+
}
|
|
52
|
+
if (event !== "changed" || !data) return null;
|
|
53
|
+
try {
|
|
54
|
+
const parsed = JSON.parse(data);
|
|
55
|
+
if (parsed.vault_id !== "central" || !Array.isArray(parsed.paths)) return null;
|
|
56
|
+
return { vault_id: "central", paths: parsed.paths.filter((path) => typeof path === "string") };
|
|
57
|
+
} catch {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async function applyMirrorPaths(opts) {
|
|
62
|
+
const ordered = orderMirrorPaths(opts.paths);
|
|
63
|
+
const release = await opts.lock();
|
|
64
|
+
if (!release) return { copied: [], skipped: ordered };
|
|
65
|
+
try {
|
|
66
|
+
const copied = [];
|
|
67
|
+
const skipped = [];
|
|
68
|
+
for (const rel of ordered) {
|
|
69
|
+
const body = await opts.getObject(rel);
|
|
70
|
+
if (!body) {
|
|
71
|
+
skipped.push(rel);
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
const result = await opts.write(rel, body);
|
|
75
|
+
if (result === "conflict") skipped.push(rel);
|
|
76
|
+
else copied.push(rel);
|
|
77
|
+
}
|
|
78
|
+
return { copied, skipped };
|
|
79
|
+
} finally {
|
|
80
|
+
await release();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function createS3GetObject(opts) {
|
|
84
|
+
const prefix = opts.prefix ?? "";
|
|
85
|
+
const resolveKey = (rel) => [prefix, rel].filter(Boolean).join("/");
|
|
86
|
+
return async (key) => {
|
|
87
|
+
if (!admitMirrorPath(key)) return null;
|
|
88
|
+
try {
|
|
89
|
+
const response = await opts.client.send(new GetObjectCommand({ Bucket: opts.bucket, Key: resolveKey(key) }));
|
|
90
|
+
if (!response.Body) return null;
|
|
91
|
+
const bytes = Buffer.from(await response.Body.transformToByteArray());
|
|
92
|
+
return bytes.length > opts.maxBytes ? null : bytes;
|
|
93
|
+
} catch (error) {
|
|
94
|
+
const status = error.$metadata?.httpStatusCode;
|
|
95
|
+
if (status === 404 || error.name === "NoSuchKey") return null;
|
|
96
|
+
throw error;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
async function startMirrorListener(input) {
|
|
101
|
+
const fetchImpl = input.fetchImpl ?? fetch;
|
|
102
|
+
const write = (rel, body) => writeRegularExclusive(input.config.mirrorRoot, rel, body);
|
|
103
|
+
const lock = input.lock ?? (() => acquireWikiFetchPullLock(input.home));
|
|
104
|
+
let delayMs = 1e3;
|
|
105
|
+
while (!input.signal.aborted) {
|
|
106
|
+
try {
|
|
107
|
+
const response = await fetchImpl(input.eventsUrl, {
|
|
108
|
+
headers: { Authorization: `Bearer ${input.mcpToken}`, Accept: "text/event-stream" },
|
|
109
|
+
signal: input.signal
|
|
110
|
+
});
|
|
111
|
+
if (!response.ok || !response.body) throw new Error("sse unavailable");
|
|
112
|
+
delayMs = 1e3;
|
|
113
|
+
let buffer = "";
|
|
114
|
+
const reader = response.body.getReader();
|
|
115
|
+
const decoder = new TextDecoder();
|
|
116
|
+
while (!input.signal.aborted) {
|
|
117
|
+
const { done, value } = await reader.read();
|
|
118
|
+
if (done) break;
|
|
119
|
+
buffer += decoder.decode(value, { stream: true }).replaceAll("\r\n", "\n");
|
|
120
|
+
let split;
|
|
121
|
+
while ((split = buffer.indexOf("\n\n")) >= 0) {
|
|
122
|
+
const block = buffer.slice(0, split);
|
|
123
|
+
buffer = buffer.slice(split + 2);
|
|
124
|
+
const changed = parseChangedSseBlock(block);
|
|
125
|
+
if (!changed) continue;
|
|
126
|
+
await applyMirrorPaths({ paths: changed.paths, getObject: input.getObject, write, lock });
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
} catch (error) {
|
|
130
|
+
if (input.signal.aborted) return;
|
|
131
|
+
if (error.name === "AbortError") return;
|
|
132
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
133
|
+
delayMs = Math.min(delayMs * 2, 3e4);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function parseDestinationForMirror(destination) {
|
|
138
|
+
return parseDestination(destination);
|
|
139
|
+
}
|
|
140
|
+
export {
|
|
141
|
+
acquireWikiFetchPullLock,
|
|
142
|
+
admitMirrorPath,
|
|
143
|
+
applyMirrorPaths,
|
|
144
|
+
createS3GetObject,
|
|
145
|
+
eventsUrlFromMcp,
|
|
146
|
+
orderMirrorPaths,
|
|
147
|
+
parseChangedSseBlock,
|
|
148
|
+
parseDestinationForMirror,
|
|
149
|
+
startMirrorListener,
|
|
150
|
+
wikiFetchPullLockDir
|
|
151
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
assertClipS3Endpoint,
|
|
4
|
+
conditionalCreateProven,
|
|
5
|
+
evidencePath,
|
|
6
|
+
isRfc1918OrLoopback,
|
|
7
|
+
loadClipCredentials,
|
|
8
|
+
validateRuntime
|
|
9
|
+
} from "./chunk-ABRYBO4T.js";
|
|
10
|
+
import "./chunk-LOVLZNLX.js";
|
|
11
|
+
import "./chunk-SKOLE6US.js";
|
|
12
|
+
import "./chunk-7POLZOFY.js";
|
|
13
|
+
export {
|
|
14
|
+
assertClipS3Endpoint,
|
|
15
|
+
conditionalCreateProven,
|
|
16
|
+
evidencePath,
|
|
17
|
+
isRfc1918OrLoopback,
|
|
18
|
+
loadClipCredentials,
|
|
19
|
+
validateRuntime
|
|
20
|
+
};
|
package/dist/skillwiki-mcp.js
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
runSkillwikiMcpStdio
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-APKDTEVV.js";
|
|
5
|
+
import "./chunk-RR6VDWSI.js";
|
|
5
6
|
import "./chunk-7I2TPIV5.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-IR2DI4Y5.js";
|
|
8
|
+
import "./chunk-Q6EZF37H.js";
|
|
9
|
+
import "./chunk-CKQPUHM2.js";
|
|
10
|
+
import "./chunk-KJG2CSYD.js";
|
|
11
|
+
import "./chunk-TKX6PSWZ.js";
|
|
12
|
+
import "./chunk-DOHWNPAZ.js";
|
|
13
|
+
import "./chunk-25OXNFDV.js";
|
|
14
|
+
import "./chunk-EE7W3GLA.js";
|
|
15
|
+
import "./chunk-ABRYBO4T.js";
|
|
16
|
+
import "./chunk-LOVLZNLX.js";
|
|
17
|
+
import "./chunk-SKOLE6US.js";
|
|
18
|
+
import "./chunk-7POLZOFY.js";
|
|
12
19
|
|
|
13
20
|
// src/mcp-entry.ts
|
|
14
21
|
runSkillwikiMcpStdio().catch((error) => {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
createS3CreateOnlyPut,
|
|
4
|
+
parseDestination,
|
|
5
|
+
sha256Hex,
|
|
6
|
+
uploadBundle
|
|
7
|
+
} from "./chunk-ZRGZBAVS.js";
|
|
8
|
+
import "./chunk-QESNTTVY.js";
|
|
9
|
+
export {
|
|
10
|
+
createS3CreateOnlyPut,
|
|
11
|
+
parseDestination,
|
|
12
|
+
sha256Hex,
|
|
13
|
+
uploadBundle
|
|
14
|
+
};
|