skillwiki 0.8.5-beta.2 → 0.8.5-beta.3
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,7 +1,13 @@
|
|
|
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
|
|
@@ -4020,14 +4026,6 @@ import { platform as platform2 } from "os";
|
|
|
4020
4026
|
import { readFileSync as readFileSync4, writeFileSync as writeFileSync4, existsSync as existsSync7, mkdirSync as mkdirSync3 } from "fs";
|
|
4021
4027
|
import { join as join24, dirname as dirname9 } from "path";
|
|
4022
4028
|
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
4029
|
function cachePath(home) {
|
|
4032
4030
|
return join24(home, ".skillwiki", CACHE_FILENAME);
|
|
4033
4031
|
}
|
|
@@ -4053,12 +4051,17 @@ function writeCache(home, cache) {
|
|
|
4053
4051
|
}
|
|
4054
4052
|
function latestFromCache(home, currentVersion) {
|
|
4055
4053
|
const { cache } = readCache(home);
|
|
4056
|
-
if (!cache || !cache.latestVersion) return { hasUpdate: false, latest: null };
|
|
4054
|
+
if (!cache || !cache.latestVersion) return { hasUpdate: false, latest: null, distTag: DIST_TAG };
|
|
4055
|
+
const distTag = normalizeDistTag(cache.distTag);
|
|
4057
4056
|
return {
|
|
4058
4057
|
hasUpdate: semverGt(cache.latestVersion, currentVersion),
|
|
4059
|
-
latest: cache.latestVersion
|
|
4058
|
+
latest: cache.latestVersion,
|
|
4059
|
+
distTag
|
|
4060
4060
|
};
|
|
4061
4061
|
}
|
|
4062
|
+
function distTagFromCache(home) {
|
|
4063
|
+
return normalizeDistTag(readCacheRaw(home)?.distTag);
|
|
4064
|
+
}
|
|
4062
4065
|
function isDisabled() {
|
|
4063
4066
|
return !!(process.env[ENV_DISABLE_KEY] || process.env.NODE_ENV === "test" || process.argv.includes(CLI_DISABLE_FLAG));
|
|
4064
4067
|
}
|
|
@@ -4066,9 +4069,10 @@ function triggerAutoUpdate(home, currentVersion) {
|
|
|
4066
4069
|
if (isDisabled()) return;
|
|
4067
4070
|
const { isStale: isStale2 } = readCache(home);
|
|
4068
4071
|
if (!isStale2) return;
|
|
4072
|
+
const distTag = distTagFromCache(home);
|
|
4069
4073
|
const bgScript = new URL("../auto-update-bg.js", import.meta.url).pathname;
|
|
4070
4074
|
if (!existsSync7(bgScript)) return;
|
|
4071
|
-
const child = spawn(process.execPath, [bgScript, home, currentVersion], {
|
|
4075
|
+
const child = spawn(process.execPath, [bgScript, home, currentVersion, distTag], {
|
|
4072
4076
|
detached: true,
|
|
4073
4077
|
stdio: "ignore"
|
|
4074
4078
|
});
|
|
@@ -4610,14 +4614,14 @@ function checkDuplicateSkills(home) {
|
|
|
4610
4614
|
return check(status, "skills_duplicate", "Skills not duplicated", parts.join("; "));
|
|
4611
4615
|
}
|
|
4612
4616
|
function checkNpmUpdate(home, currentVersion) {
|
|
4613
|
-
const { hasUpdate, latest } = latestFromCache(home, currentVersion);
|
|
4617
|
+
const { hasUpdate, latest, distTag } = latestFromCache(home, currentVersion);
|
|
4614
4618
|
if (!latest) {
|
|
4615
|
-
return check("pass", "npm_update", "npm CLI version", `v${currentVersion} (no cache yet)`);
|
|
4619
|
+
return check("pass", "npm_update", "npm CLI version", `v${currentVersion} (${distTag}: no cache yet)`);
|
|
4616
4620
|
}
|
|
4617
4621
|
if (hasUpdate) {
|
|
4618
|
-
return check("warn", "npm_update", "npm CLI version", `v${currentVersion} \u2014 update available: v${latest}. Run \`skillwiki update\`.`);
|
|
4622
|
+
return check("warn", "npm_update", "npm CLI version", `v${currentVersion} \u2014 ${distTag} update available: v${latest}. Run \`skillwiki update --tag ${distTag}\`.`);
|
|
4619
4623
|
}
|
|
4620
|
-
return check("pass", "npm_update", "npm CLI version", `v${currentVersion} (
|
|
4624
|
+
return check("pass", "npm_update", "npm CLI version", `v${currentVersion} (${distTag}: v${latest})`);
|
|
4621
4625
|
}
|
|
4622
4626
|
function checkPluginVersionDrift(home, currentVersion) {
|
|
4623
4627
|
const plugins = findPluginInstallations(home);
|
|
@@ -6176,7 +6180,7 @@ async function runUpdate(input) {
|
|
|
6176
6180
|
readFileSync8(new URL("../../package.json", import.meta.url), "utf8")
|
|
6177
6181
|
);
|
|
6178
6182
|
const currentVersion = pkg2.version;
|
|
6179
|
-
const tag = input.distTag
|
|
6183
|
+
const tag = normalizeDistTag(input.distTag);
|
|
6180
6184
|
const target = join29(input.home, ".claude", "skills");
|
|
6181
6185
|
let latest;
|
|
6182
6186
|
try {
|
|
@@ -6193,7 +6197,8 @@ async function runUpdate(input) {
|
|
|
6193
6197
|
const cache = {
|
|
6194
6198
|
lastCheck: Date.now(),
|
|
6195
6199
|
latestVersion: latest,
|
|
6196
|
-
currentVersion
|
|
6200
|
+
currentVersion,
|
|
6201
|
+
distTag: tag
|
|
6197
6202
|
};
|
|
6198
6203
|
if (latest === currentVersion) {
|
|
6199
6204
|
writeCache(input.home, cache);
|
|
@@ -6205,7 +6210,7 @@ async function runUpdate(input) {
|
|
|
6205
6210
|
wasAlreadyLatest: true,
|
|
6206
6211
|
version_warnings: [],
|
|
6207
6212
|
skills_refreshed: false,
|
|
6208
|
-
humanHint: `Already on
|
|
6213
|
+
humanHint: `Already on npm@${tag}: v${currentVersion}`
|
|
6209
6214
|
})
|
|
6210
6215
|
};
|
|
6211
6216
|
}
|
|
@@ -6225,7 +6230,7 @@ async function runUpdate(input) {
|
|
|
6225
6230
|
const version_warnings = installResult.warnings;
|
|
6226
6231
|
const skills_refreshed = installResult.refreshed;
|
|
6227
6232
|
const hintLines = [
|
|
6228
|
-
`Updated skillwiki ${currentVersion} \u2192 ${latest}`,
|
|
6233
|
+
`Updated skillwiki ${currentVersion} \u2192 ${latest} via npm@${tag}`,
|
|
6229
6234
|
`skills refreshed: ${skills_refreshed}`
|
|
6230
6235
|
];
|
|
6231
6236
|
if (version_warnings.length > 0) {
|
|
@@ -6255,6 +6260,7 @@ async function runSelfUpdate(input) {
|
|
|
6255
6260
|
readFileSync9(new URL("../../package.json", import.meta.url), "utf8")
|
|
6256
6261
|
).version;
|
|
6257
6262
|
const sourceRoot = input.sourceRoot ?? `${input.home}${DEFAULT_SOURCE_ROOT_SUFFIX}`;
|
|
6263
|
+
const distTag = normalizeDistTag(input.distTag);
|
|
6258
6264
|
const localPkgPath = join30(sourceRoot, "packages", "cli", "package.json");
|
|
6259
6265
|
const hasLocalSource = existsSync11(localPkgPath);
|
|
6260
6266
|
if (input.check) {
|
|
@@ -6270,7 +6276,7 @@ async function runSelfUpdate(input) {
|
|
|
6270
6276
|
} else {
|
|
6271
6277
|
source = "npm";
|
|
6272
6278
|
try {
|
|
6273
|
-
availableVersion = execSync4(
|
|
6279
|
+
availableVersion = execSync4(`npm view skillwiki@${distTag} version`, {
|
|
6274
6280
|
encoding: "utf8",
|
|
6275
6281
|
timeout: 15e3
|
|
6276
6282
|
}).trim();
|
|
@@ -6340,7 +6346,7 @@ async function runSelfUpdate(input) {
|
|
|
6340
6346
|
}
|
|
6341
6347
|
let latestVersion;
|
|
6342
6348
|
try {
|
|
6343
|
-
latestVersion = execSync4(
|
|
6349
|
+
latestVersion = execSync4(`npm view skillwiki@${distTag} version`, {
|
|
6344
6350
|
encoding: "utf8",
|
|
6345
6351
|
timeout: 15e3
|
|
6346
6352
|
}).trim();
|
|
@@ -6358,12 +6364,12 @@ async function runSelfUpdate(input) {
|
|
|
6358
6364
|
currentVersion,
|
|
6359
6365
|
availableVersion: latestVersion,
|
|
6360
6366
|
updateAvailable: false,
|
|
6361
|
-
humanHint: `Already on
|
|
6367
|
+
humanHint: `Already on ${distTag}: v${currentVersion}`
|
|
6362
6368
|
})
|
|
6363
6369
|
};
|
|
6364
6370
|
}
|
|
6365
6371
|
try {
|
|
6366
|
-
execSync4(
|
|
6372
|
+
execSync4(`npm install -g skillwiki@${distTag}`, {
|
|
6367
6373
|
stdio: "pipe",
|
|
6368
6374
|
timeout: 6e4
|
|
6369
6375
|
});
|
|
@@ -6381,7 +6387,7 @@ async function runSelfUpdate(input) {
|
|
|
6381
6387
|
availableVersion: latestVersion,
|
|
6382
6388
|
updateAvailable: true,
|
|
6383
6389
|
newVersion: latestVersion,
|
|
6384
|
-
humanHint: `Updated skillwiki ${currentVersion} \u2192 ${latestVersion} via npm
|
|
6390
|
+
humanHint: `Updated skillwiki ${currentVersion} \u2192 ${latestVersion} via npm@${distTag}`
|
|
6385
6391
|
})
|
|
6386
6392
|
};
|
|
6387
6393
|
}
|
|
@@ -8830,13 +8836,14 @@ program.command("frontmatter-fix [vault]").description("fix common frontmatter i
|
|
|
8830
8836
|
if (!v.ok) emit({ exitCode: v.exitCode, result: v.payload });
|
|
8831
8837
|
else emit(await runFrontmatterFix({ vault: v.vault, dryRun: !!opts.dryRun }), v.vault);
|
|
8832
8838
|
});
|
|
8833
|
-
program.command("update").description("update skillwiki CLI
|
|
8839
|
+
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
8840
|
home: process.env.HOME ?? "",
|
|
8835
8841
|
distTag: opts.tag
|
|
8836
8842
|
})));
|
|
8837
|
-
program.command("self-update").description("update skillwiki CLI from local source or npm
|
|
8843
|
+
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
8844
|
home: process.env.HOME ?? "",
|
|
8839
|
-
check: !!opts.check
|
|
8845
|
+
check: !!opts.check,
|
|
8846
|
+
distTag: opts.tag
|
|
8840
8847
|
})));
|
|
8841
8848
|
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
8849
|
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.3",
|
|
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": {
|