@mkterswingman/yt-mcp 0.3.1 → 0.3.2
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/cli/index.js +54 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { execSync } from "node:child_process";
|
|
3
|
+
import { readFileSync } from "node:fs";
|
|
4
|
+
import { join, dirname } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
const pkgPath = join(__dirname, "..", "..", "package.json");
|
|
8
|
+
function getVersion() {
|
|
9
|
+
try {
|
|
10
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
|
|
11
|
+
return pkg.version ?? "unknown";
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return "unknown";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
2
17
|
const command = process.argv[2];
|
|
3
18
|
async function main() {
|
|
4
19
|
switch (command) {
|
|
@@ -17,14 +32,53 @@ async function main() {
|
|
|
17
32
|
await runSetupCookies();
|
|
18
33
|
break;
|
|
19
34
|
}
|
|
35
|
+
case "update": {
|
|
36
|
+
const current = getVersion();
|
|
37
|
+
console.log(`Current version: ${current}`);
|
|
38
|
+
console.log("Checking for updates...\n");
|
|
39
|
+
try {
|
|
40
|
+
const latest = execSync("npm view @mkterswingman/yt-mcp version", {
|
|
41
|
+
encoding: "utf8",
|
|
42
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
43
|
+
}).trim();
|
|
44
|
+
if (latest === current) {
|
|
45
|
+
console.log(`✅ Already on the latest version (${current})`);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
console.log(`New version available: ${latest}`);
|
|
49
|
+
console.log("Updating...\n");
|
|
50
|
+
execSync("npm install -g @mkterswingman/yt-mcp@latest", {
|
|
51
|
+
stdio: "inherit",
|
|
52
|
+
});
|
|
53
|
+
console.log(`\n✅ Updated to ${latest}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
58
|
+
console.error(`❌ Update failed: ${msg}`);
|
|
59
|
+
console.error("Try manually: npm install -g @mkterswingman/yt-mcp@latest");
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
case "version":
|
|
65
|
+
case "--version":
|
|
66
|
+
case "-v": {
|
|
67
|
+
console.log(getVersion());
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
20
70
|
default:
|
|
21
71
|
console.log(`
|
|
72
|
+
yt-mcp v${getVersion()}
|
|
73
|
+
|
|
22
74
|
Usage: yt-mcp <command>
|
|
23
75
|
|
|
24
76
|
Commands:
|
|
25
77
|
setup Run first-time setup (OAuth + cookies + MCP registration)
|
|
26
78
|
serve Start the MCP server (stdio transport)
|
|
27
79
|
setup-cookies Refresh YouTube cookies using browser login
|
|
80
|
+
update Update to the latest version
|
|
81
|
+
version Show current version
|
|
28
82
|
|
|
29
83
|
Environment variables:
|
|
30
84
|
YT_MCP_TOKEN Personal Access Token (skips OAuth)
|
|
@@ -36,4 +90,3 @@ main().catch((err) => {
|
|
|
36
90
|
console.error("Fatal error:", err);
|
|
37
91
|
process.exit(1);
|
|
38
92
|
});
|
|
39
|
-
export {};
|