skillwiki 0.8.5-beta.2 → 0.8.5-beta.4
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/auto-update-bg.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
#!/usr/bin/env node
|
|
3
3
|
import {
|
|
4
|
+
normalizeDistTag,
|
|
4
5
|
semverGt
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-E6UWZ3S3.js";
|
|
6
7
|
|
|
7
8
|
// src/auto-update-bg.ts
|
|
8
9
|
import { execSync } from "child_process";
|
|
@@ -10,11 +11,12 @@ import { writeFileSync, mkdirSync } from "fs";
|
|
|
10
11
|
import { join, dirname } from "path";
|
|
11
12
|
var home = process.argv[2];
|
|
12
13
|
var currentVersion = process.argv[3];
|
|
14
|
+
var distTag = normalizeDistTag(process.argv[4]);
|
|
13
15
|
if (!home || !currentVersion) process.exit(0);
|
|
14
16
|
var cacheFile = join(home, ".skillwiki", ".update-cache.json");
|
|
15
17
|
setTimeout(() => process.exit(0), 3e4);
|
|
16
18
|
try {
|
|
17
|
-
const latest = execSync(
|
|
19
|
+
const latest = execSync(`npm view skillwiki@${distTag} version`, {
|
|
18
20
|
encoding: "utf8",
|
|
19
21
|
timeout: 15e3
|
|
20
22
|
}).trim();
|
|
@@ -22,10 +24,11 @@ try {
|
|
|
22
24
|
const cache = {
|
|
23
25
|
lastCheck: Date.now(),
|
|
24
26
|
latestVersion: latest,
|
|
25
|
-
currentVersion
|
|
27
|
+
currentVersion,
|
|
28
|
+
distTag
|
|
26
29
|
};
|
|
27
30
|
if (semverGt(latest, currentVersion)) {
|
|
28
|
-
execSync(
|
|
31
|
+
execSync(`npm install -g skillwiki@${distTag}`, {
|
|
29
32
|
stdio: "ignore",
|
|
30
33
|
timeout: 6e4
|
|
31
34
|
});
|
|
@@ -36,7 +39,7 @@ try {
|
|
|
36
39
|
} catch {
|
|
37
40
|
try {
|
|
38
41
|
mkdirSync(dirname(cacheFile), { recursive: true });
|
|
39
|
-
writeFileSync(cacheFile, JSON.stringify({ lastCheck: Date.now(), latestVersion: "", currentVersion }, null, 2));
|
|
42
|
+
writeFileSync(cacheFile, JSON.stringify({ lastCheck: Date.now(), latestVersion: "", currentVersion, distTag }, null, 2));
|
|
40
43
|
} catch {
|
|
41
44
|
}
|
|
42
45
|
}
|
|
@@ -40,6 +40,23 @@ function parseSemver(version) {
|
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
// src/utils/update-consts.ts
|
|
44
|
+
var DIST_TAG = "latest";
|
|
45
|
+
var CACHE_FILENAME = ".update-cache.json";
|
|
46
|
+
var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
|
|
47
|
+
var ENV_DISABLE_KEY = "NO_UPDATE_NOTIFIER";
|
|
48
|
+
var CLI_DISABLE_FLAG = "--no-update-notifier";
|
|
49
|
+
function normalizeDistTag(tag) {
|
|
50
|
+
const value = (tag ?? DIST_TAG).trim();
|
|
51
|
+
return /^[A-Za-z0-9._-]+$/.test(value) ? value : DIST_TAG;
|
|
52
|
+
}
|
|
53
|
+
|
|
43
54
|
export {
|
|
44
|
-
semverGt
|
|
55
|
+
semverGt,
|
|
56
|
+
DIST_TAG,
|
|
57
|
+
CACHE_FILENAME,
|
|
58
|
+
CHECK_INTERVAL_MS,
|
|
59
|
+
ENV_DISABLE_KEY,
|
|
60
|
+
CLI_DISABLE_FLAG,
|
|
61
|
+
normalizeDistTag
|
|
45
62
|
};
|
package/dist/cli.js
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
+
CACHE_FILENAME,
|
|
4
|
+
CHECK_INTERVAL_MS,
|
|
5
|
+
CLI_DISABLE_FLAG,
|
|
6
|
+
DIST_TAG,
|
|
7
|
+
ENV_DISABLE_KEY,
|
|
8
|
+
normalizeDistTag,
|
|
3
9
|
semverGt
|
|
4
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-E6UWZ3S3.js";
|
|
5
11
|
import {
|
|
6
12
|
git,
|
|
7
13
|
gitStrict
|
|
8
14
|
} from "./chunk-TPS5XD2J.js";
|
|
9
15
|
|
|
10
16
|
// src/cli.ts
|
|
11
|
-
import { readFileSync as readFileSync12 } from "fs";
|
|
12
17
|
import { join as join44 } from "path";
|
|
13
18
|
import { Command as Command2 } from "commander";
|
|
14
19
|
|
|
@@ -4020,14 +4025,6 @@ import { platform as platform2 } from "os";
|
|
|
4020
4025
|
import { readFileSync as readFileSync4, writeFileSync as writeFileSync4, existsSync as existsSync7, mkdirSync as mkdirSync3 } from "fs";
|
|
4021
4026
|
import { join as join24, dirname as dirname9 } from "path";
|
|
4022
4027
|
import { spawn } from "child_process";
|
|
4023
|
-
|
|
4024
|
-
// src/utils/update-consts.ts
|
|
4025
|
-
var CACHE_FILENAME = ".update-cache.json";
|
|
4026
|
-
var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
|
|
4027
|
-
var ENV_DISABLE_KEY = "NO_UPDATE_NOTIFIER";
|
|
4028
|
-
var CLI_DISABLE_FLAG = "--no-update-notifier";
|
|
4029
|
-
|
|
4030
|
-
// src/utils/auto-update.ts
|
|
4031
4028
|
function cachePath(home) {
|
|
4032
4029
|
return join24(home, ".skillwiki", CACHE_FILENAME);
|
|
4033
4030
|
}
|
|
@@ -4053,12 +4050,17 @@ function writeCache(home, cache) {
|
|
|
4053
4050
|
}
|
|
4054
4051
|
function latestFromCache(home, currentVersion) {
|
|
4055
4052
|
const { cache } = readCache(home);
|
|
4056
|
-
if (!cache || !cache.latestVersion) return { hasUpdate: false, latest: null };
|
|
4053
|
+
if (!cache || !cache.latestVersion) return { hasUpdate: false, latest: null, distTag: DIST_TAG };
|
|
4054
|
+
const distTag = normalizeDistTag(cache.distTag);
|
|
4057
4055
|
return {
|
|
4058
4056
|
hasUpdate: semverGt(cache.latestVersion, currentVersion),
|
|
4059
|
-
latest: cache.latestVersion
|
|
4057
|
+
latest: cache.latestVersion,
|
|
4058
|
+
distTag
|
|
4060
4059
|
};
|
|
4061
4060
|
}
|
|
4061
|
+
function distTagFromCache(home) {
|
|
4062
|
+
return normalizeDistTag(readCacheRaw(home)?.distTag);
|
|
4063
|
+
}
|
|
4062
4064
|
function isDisabled() {
|
|
4063
4065
|
return !!(process.env[ENV_DISABLE_KEY] || process.env.NODE_ENV === "test" || process.argv.includes(CLI_DISABLE_FLAG));
|
|
4064
4066
|
}
|
|
@@ -4066,9 +4068,10 @@ function triggerAutoUpdate(home, currentVersion) {
|
|
|
4066
4068
|
if (isDisabled()) return;
|
|
4067
4069
|
const { isStale: isStale2 } = readCache(home);
|
|
4068
4070
|
if (!isStale2) return;
|
|
4071
|
+
const distTag = distTagFromCache(home);
|
|
4069
4072
|
const bgScript = new URL("../auto-update-bg.js", import.meta.url).pathname;
|
|
4070
4073
|
if (!existsSync7(bgScript)) return;
|
|
4071
|
-
const child = spawn(process.execPath, [bgScript, home, currentVersion], {
|
|
4074
|
+
const child = spawn(process.execPath, [bgScript, home, currentVersion, distTag], {
|
|
4072
4075
|
detached: true,
|
|
4073
4076
|
stdio: "ignore"
|
|
4074
4077
|
});
|
|
@@ -4610,14 +4613,14 @@ function checkDuplicateSkills(home) {
|
|
|
4610
4613
|
return check(status, "skills_duplicate", "Skills not duplicated", parts.join("; "));
|
|
4611
4614
|
}
|
|
4612
4615
|
function checkNpmUpdate(home, currentVersion) {
|
|
4613
|
-
const { hasUpdate, latest } = latestFromCache(home, currentVersion);
|
|
4616
|
+
const { hasUpdate, latest, distTag } = latestFromCache(home, currentVersion);
|
|
4614
4617
|
if (!latest) {
|
|
4615
|
-
return check("pass", "npm_update", "npm CLI version", `v${currentVersion} (no cache yet)`);
|
|
4618
|
+
return check("pass", "npm_update", "npm CLI version", `v${currentVersion} (${distTag}: no cache yet)`);
|
|
4616
4619
|
}
|
|
4617
4620
|
if (hasUpdate) {
|
|
4618
|
-
return check("warn", "npm_update", "npm CLI version", `v${currentVersion} \u2014 update available: v${latest}. Run \`skillwiki update\`.`);
|
|
4621
|
+
return check("warn", "npm_update", "npm CLI version", `v${currentVersion} \u2014 ${distTag} update available: v${latest}. Run \`skillwiki update --tag ${distTag}\`.`);
|
|
4619
4622
|
}
|
|
4620
|
-
return check("pass", "npm_update", "npm CLI version", `v${currentVersion} (
|
|
4623
|
+
return check("pass", "npm_update", "npm CLI version", `v${currentVersion} (${distTag}: v${latest})`);
|
|
4621
4624
|
}
|
|
4622
4625
|
function checkPluginVersionDrift(home, currentVersion) {
|
|
4623
4626
|
const plugins = findPluginInstallations(home);
|
|
@@ -6143,8 +6146,30 @@ ${newBody}`;
|
|
|
6143
6146
|
|
|
6144
6147
|
// src/commands/update.ts
|
|
6145
6148
|
import { execSync as execSync3 } from "child_process";
|
|
6146
|
-
import { readFileSync as readFileSync8 } from "fs";
|
|
6147
6149
|
import { join as join29 } from "path";
|
|
6150
|
+
|
|
6151
|
+
// src/utils/package-info.ts
|
|
6152
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
6153
|
+
function packageJsonCandidateUrls(baseUrl = import.meta.url) {
|
|
6154
|
+
return [
|
|
6155
|
+
new URL("../package.json", baseUrl),
|
|
6156
|
+
new URL("../../package.json", baseUrl)
|
|
6157
|
+
];
|
|
6158
|
+
}
|
|
6159
|
+
function readCliPackageJson(baseUrl = import.meta.url) {
|
|
6160
|
+
for (const url of packageJsonCandidateUrls(baseUrl)) {
|
|
6161
|
+
try {
|
|
6162
|
+
const pkg2 = JSON.parse(readFileSync8(url, "utf8"));
|
|
6163
|
+
if (typeof pkg2.version === "string") {
|
|
6164
|
+
return { ...pkg2, version: pkg2.version };
|
|
6165
|
+
}
|
|
6166
|
+
} catch {
|
|
6167
|
+
}
|
|
6168
|
+
}
|
|
6169
|
+
throw new Error(`Could not locate skillwiki package.json from ${baseUrl}`);
|
|
6170
|
+
}
|
|
6171
|
+
|
|
6172
|
+
// src/commands/update.ts
|
|
6148
6173
|
function resolveGlobalSkillsRoot() {
|
|
6149
6174
|
try {
|
|
6150
6175
|
const globalRoot = execSync3("npm root -g", {
|
|
@@ -6172,11 +6197,9 @@ async function refreshInstalledSkills(target) {
|
|
|
6172
6197
|
}
|
|
6173
6198
|
}
|
|
6174
6199
|
async function runUpdate(input) {
|
|
6175
|
-
const pkg2 =
|
|
6176
|
-
readFileSync8(new URL("../../package.json", import.meta.url), "utf8")
|
|
6177
|
-
);
|
|
6200
|
+
const pkg2 = readCliPackageJson();
|
|
6178
6201
|
const currentVersion = pkg2.version;
|
|
6179
|
-
const tag = input.distTag
|
|
6202
|
+
const tag = normalizeDistTag(input.distTag);
|
|
6180
6203
|
const target = join29(input.home, ".claude", "skills");
|
|
6181
6204
|
let latest;
|
|
6182
6205
|
try {
|
|
@@ -6193,7 +6216,8 @@ async function runUpdate(input) {
|
|
|
6193
6216
|
const cache = {
|
|
6194
6217
|
lastCheck: Date.now(),
|
|
6195
6218
|
latestVersion: latest,
|
|
6196
|
-
currentVersion
|
|
6219
|
+
currentVersion,
|
|
6220
|
+
distTag: tag
|
|
6197
6221
|
};
|
|
6198
6222
|
if (latest === currentVersion) {
|
|
6199
6223
|
writeCache(input.home, cache);
|
|
@@ -6205,7 +6229,7 @@ async function runUpdate(input) {
|
|
|
6205
6229
|
wasAlreadyLatest: true,
|
|
6206
6230
|
version_warnings: [],
|
|
6207
6231
|
skills_refreshed: false,
|
|
6208
|
-
humanHint: `Already on
|
|
6232
|
+
humanHint: `Already on npm@${tag}: v${currentVersion}`
|
|
6209
6233
|
})
|
|
6210
6234
|
};
|
|
6211
6235
|
}
|
|
@@ -6225,7 +6249,7 @@ async function runUpdate(input) {
|
|
|
6225
6249
|
const version_warnings = installResult.warnings;
|
|
6226
6250
|
const skills_refreshed = installResult.refreshed;
|
|
6227
6251
|
const hintLines = [
|
|
6228
|
-
`Updated skillwiki ${currentVersion} \u2192 ${latest}`,
|
|
6252
|
+
`Updated skillwiki ${currentVersion} \u2192 ${latest} via npm@${tag}`,
|
|
6229
6253
|
`skills refreshed: ${skills_refreshed}`
|
|
6230
6254
|
];
|
|
6231
6255
|
if (version_warnings.length > 0) {
|
|
@@ -6251,10 +6275,9 @@ import { existsSync as existsSync11, readFileSync as readFileSync9 } from "fs";
|
|
|
6251
6275
|
import { join as join30 } from "path";
|
|
6252
6276
|
var DEFAULT_SOURCE_ROOT_SUFFIX = "/Desktop/code/llm-wiki";
|
|
6253
6277
|
async function runSelfUpdate(input) {
|
|
6254
|
-
const currentVersion =
|
|
6255
|
-
readFileSync9(new URL("../../package.json", import.meta.url), "utf8")
|
|
6256
|
-
).version;
|
|
6278
|
+
const currentVersion = readCliPackageJson().version;
|
|
6257
6279
|
const sourceRoot = input.sourceRoot ?? `${input.home}${DEFAULT_SOURCE_ROOT_SUFFIX}`;
|
|
6280
|
+
const distTag = normalizeDistTag(input.distTag);
|
|
6258
6281
|
const localPkgPath = join30(sourceRoot, "packages", "cli", "package.json");
|
|
6259
6282
|
const hasLocalSource = existsSync11(localPkgPath);
|
|
6260
6283
|
if (input.check) {
|
|
@@ -6270,7 +6293,7 @@ async function runSelfUpdate(input) {
|
|
|
6270
6293
|
} else {
|
|
6271
6294
|
source = "npm";
|
|
6272
6295
|
try {
|
|
6273
|
-
availableVersion = execSync4(
|
|
6296
|
+
availableVersion = execSync4(`npm view skillwiki@${distTag} version`, {
|
|
6274
6297
|
encoding: "utf8",
|
|
6275
6298
|
timeout: 15e3
|
|
6276
6299
|
}).trim();
|
|
@@ -6340,7 +6363,7 @@ async function runSelfUpdate(input) {
|
|
|
6340
6363
|
}
|
|
6341
6364
|
let latestVersion;
|
|
6342
6365
|
try {
|
|
6343
|
-
latestVersion = execSync4(
|
|
6366
|
+
latestVersion = execSync4(`npm view skillwiki@${distTag} version`, {
|
|
6344
6367
|
encoding: "utf8",
|
|
6345
6368
|
timeout: 15e3
|
|
6346
6369
|
}).trim();
|
|
@@ -6358,12 +6381,12 @@ async function runSelfUpdate(input) {
|
|
|
6358
6381
|
currentVersion,
|
|
6359
6382
|
availableVersion: latestVersion,
|
|
6360
6383
|
updateAvailable: false,
|
|
6361
|
-
humanHint: `Already on
|
|
6384
|
+
humanHint: `Already on ${distTag}: v${currentVersion}`
|
|
6362
6385
|
})
|
|
6363
6386
|
};
|
|
6364
6387
|
}
|
|
6365
6388
|
try {
|
|
6366
|
-
execSync4(
|
|
6389
|
+
execSync4(`npm install -g skillwiki@${distTag}`, {
|
|
6367
6390
|
stdio: "pipe",
|
|
6368
6391
|
timeout: 6e4
|
|
6369
6392
|
});
|
|
@@ -6381,7 +6404,7 @@ async function runSelfUpdate(input) {
|
|
|
6381
6404
|
availableVersion: latestVersion,
|
|
6382
6405
|
updateAvailable: true,
|
|
6383
6406
|
newVersion: latestVersion,
|
|
6384
|
-
humanHint: `Updated skillwiki ${currentVersion} \u2192 ${latestVersion} via npm
|
|
6407
|
+
humanHint: `Updated skillwiki ${currentVersion} \u2192 ${latestVersion} via npm@${distTag}`
|
|
6385
6408
|
})
|
|
6386
6409
|
};
|
|
6387
6410
|
}
|
|
@@ -8618,7 +8641,7 @@ async function postCommit(vault, exitCode) {
|
|
|
8618
8641
|
}
|
|
8619
8642
|
|
|
8620
8643
|
// src/cli.ts
|
|
8621
|
-
var pkg =
|
|
8644
|
+
var pkg = readCliPackageJson();
|
|
8622
8645
|
var program = new Command2();
|
|
8623
8646
|
program.name("skillwiki").description("Deterministic helpers for CodeWiki skills").version(pkg.version);
|
|
8624
8647
|
program.option("--human", "render terminal-readable output instead of JSON");
|
|
@@ -8830,13 +8853,14 @@ program.command("frontmatter-fix [vault]").description("fix common frontmatter i
|
|
|
8830
8853
|
if (!v.ok) emit({ exitCode: v.exitCode, result: v.payload });
|
|
8831
8854
|
else emit(await runFrontmatterFix({ vault: v.vault, dryRun: !!opts.dryRun }), v.vault);
|
|
8832
8855
|
});
|
|
8833
|
-
program.command("update").description("update skillwiki CLI
|
|
8856
|
+
program.command("update").description("update skillwiki CLI from npm dist-tag").option("--tag <tag>", "npm dist-tag", "latest").action(async (opts) => emit(await runUpdate({
|
|
8834
8857
|
home: process.env.HOME ?? "",
|
|
8835
8858
|
distTag: opts.tag
|
|
8836
8859
|
})));
|
|
8837
|
-
program.command("self-update").description("update skillwiki CLI from local source or npm
|
|
8860
|
+
program.command("self-update").description("update skillwiki CLI from local source or npm dist-tag").option("--check", "check for updates without installing", false).option("--tag <tag>", "npm dist-tag", "latest").action(async (opts) => emit(await runSelfUpdate({
|
|
8838
8861
|
home: process.env.HOME ?? "",
|
|
8839
|
-
check: !!opts.check
|
|
8862
|
+
check: !!opts.check,
|
|
8863
|
+
distTag: opts.tag
|
|
8840
8864
|
})));
|
|
8841
8865
|
program.command("transcripts [vault]").description("list transcript files in raw/transcripts/").option("--since <date>", "only files ingested on or after this date (YYYY-MM-DD)").option("--wiki <name>", "wiki profile name").action(async (vault, opts) => {
|
|
8842
8866
|
const v = await resolveVaultArg(vault, opts.wiki);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skillwiki",
|
|
3
|
-
"version": "0.8.5-beta.
|
|
3
|
+
"version": "0.8.5-beta.4",
|
|
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": {
|