@vibecodr/cli 1.0.0 → 1.0.1
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/CHANGELOG.md +58 -115
- package/MIGRATION.md +31 -2
- package/dist/auth/credential-broker.d.ts +28 -0
- package/dist/auth/credential-broker.d.ts.map +1 -0
- package/dist/auth/credential-broker.js +80 -0
- package/dist/auth/credential-broker.js.map +1 -0
- package/dist/bin/vc-tools.js +4 -0
- package/dist/bin/vc-tools.js.map +1 -1
- package/dist/bin/vibecodr-mcp.js +4 -0
- package/dist/bin/vibecodr-mcp.js.map +1 -1
- package/dist/clients/claude-code.d.ts.map +1 -1
- package/dist/clients/claude-code.js +5 -1
- package/dist/clients/claude-code.js.map +1 -1
- package/dist/core/env.d.ts +13 -0
- package/dist/core/env.d.ts.map +1 -0
- package/dist/core/env.js +62 -0
- package/dist/core/env.js.map +1 -0
- package/dist/legacy/config/store.d.ts.map +1 -1
- package/dist/legacy/config/store.js +19 -5
- package/dist/legacy/config/store.js.map +1 -1
- package/dist/legacy/core/version.d.ts +2 -2
- package/dist/legacy/core/version.js +1 -1
- package/dist/platform/paths.d.ts.map +1 -1
- package/dist/platform/paths.js +11 -1
- package/dist/platform/paths.js.map +1 -1
- package/dist/storage/config-store.d.ts.map +1 -1
- package/dist/storage/config-store.js +15 -3
- package/dist/storage/config-store.js.map +1 -1
- package/dist/storage/install-manifest.d.ts.map +1 -1
- package/dist/storage/install-manifest.js +14 -3
- package/dist/storage/install-manifest.js.map +1 -1
- package/dist/storage/migrate.d.ts +15 -0
- package/dist/storage/migrate.d.ts.map +1 -0
- package/dist/storage/migrate.js +93 -0
- package/dist/storage/migrate.js.map +1 -0
- package/dist/types/install.d.ts +4 -0
- package/dist/types/install.d.ts.map +1 -1
- package/docs/commands.md +171 -119
- package/docs/legacy/CHANGELOG-mcp-cli.md +85 -0
- package/package.json +74 -69
- package/preinstall-check.mjs +107 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// Runs as the npm `preinstall` lifecycle script before file copy. Detects the
|
|
2
|
+
// global-install collision where a pre-merger @vibecodr/vc-tools@0.1.x owns
|
|
3
|
+
// the `vc-tools` bin shim and would block npm from writing the
|
|
4
|
+
// @vibecodr/cli@1.x version of the same bin (npm refuses to overwrite a bin
|
|
5
|
+
// owned by a different package; the user otherwise sees an unhelpful EEXIST
|
|
6
|
+
// pointing at a file in the global bin dir). Exits non-zero with an
|
|
7
|
+
// actionable message so npm aborts cleanly with our text instead of npm's.
|
|
8
|
+
//
|
|
9
|
+
// Bail-outs (the check is a no-op in any of these cases):
|
|
10
|
+
// - VIBECDR_SKIP_PREINSTALL_CHECK=1 (operator opt-out)
|
|
11
|
+
// - not a global install (the conflict is global-bin-only)
|
|
12
|
+
// - running from inside this source repo (npm install / npm ci during
|
|
13
|
+
// local dev shouldn't trip the check)
|
|
14
|
+
// - npm ls fails for any other reason (we don't want a transient npm
|
|
15
|
+
// error to block legitimate installs)
|
|
16
|
+
|
|
17
|
+
import { execSync } from "node:child_process";
|
|
18
|
+
import path from "node:path";
|
|
19
|
+
import { fileURLToPath } from "node:url";
|
|
20
|
+
|
|
21
|
+
const SKIP_ENV = "VIBECDR_SKIP_PREINSTALL_CHECK";
|
|
22
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
23
|
+
const repoRoot = here;
|
|
24
|
+
|
|
25
|
+
function isLocalDevInstall() {
|
|
26
|
+
// The npm lifecycle sets npm_config_local_prefix (or PROJECT) to the
|
|
27
|
+
// directory holding the package.json being installed FROM. For npm ci/install
|
|
28
|
+
// run inside this repo, that prefix equals our repo root.
|
|
29
|
+
const localPrefix = process.env["npm_config_local_prefix"] ?? process.env["INIT_CWD"];
|
|
30
|
+
if (!localPrefix) return false;
|
|
31
|
+
try {
|
|
32
|
+
return path.resolve(localPrefix) === repoRoot;
|
|
33
|
+
} catch {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function isGlobalInstall() {
|
|
39
|
+
return process.env["npm_config_global"] === "true";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (process.env[SKIP_ENV] === "1") {
|
|
43
|
+
process.exit(0);
|
|
44
|
+
}
|
|
45
|
+
if (!isGlobalInstall()) {
|
|
46
|
+
process.exit(0);
|
|
47
|
+
}
|
|
48
|
+
if (isLocalDevInstall()) {
|
|
49
|
+
process.exit(0);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
let collidingVersion;
|
|
53
|
+
try {
|
|
54
|
+
const output = execSync("npm ls -g --depth 0 --json @vibecodr/vc-tools", {
|
|
55
|
+
encoding: "utf8",
|
|
56
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
57
|
+
});
|
|
58
|
+
const parsed = JSON.parse(output);
|
|
59
|
+
const entry = parsed?.dependencies?.["@vibecodr/vc-tools"];
|
|
60
|
+
if (entry && typeof entry.version === "string") {
|
|
61
|
+
// 0.2.x is the tombstone forwarder package; it depends on @vibecodr/cli
|
|
62
|
+
// and is the intended migration path. Only block on the legacy 0.1.x line
|
|
63
|
+
// (and a defensive guard against any pre-0.2 versions we never published).
|
|
64
|
+
if (entry.version.startsWith("0.1.")) {
|
|
65
|
+
collidingVersion = entry.version;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
} catch {
|
|
69
|
+
// npm ls exits non-zero when the package isn't installed; treat as no
|
|
70
|
+
// conflict.
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (!collidingVersion) {
|
|
74
|
+
process.exit(0);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
console.error("");
|
|
78
|
+
console.error("==========================================================================");
|
|
79
|
+
console.error(" @vibecodr/cli install blocked: legacy @vibecodr/vc-tools is in the way");
|
|
80
|
+
console.error("==========================================================================");
|
|
81
|
+
console.error("");
|
|
82
|
+
console.error(` You have @vibecodr/vc-tools@${collidingVersion} installed globally. That`);
|
|
83
|
+
console.error(" package and @vibecodr/cli@1.x both claim the `vc-tools` bin name on");
|
|
84
|
+
console.error(" disk, and npm refuses to overwrite a bin owned by a different package");
|
|
85
|
+
console.error(" (you would otherwise see a cryptic EEXIST pointing at the global bin");
|
|
86
|
+
console.error(" dir).");
|
|
87
|
+
console.error("");
|
|
88
|
+
console.error(" The merged @vibecodr/cli replaces the legacy @vibecodr/vc-tools. The");
|
|
89
|
+
console.error(" legacy line is preserved on npm under explicit version pins; nothing");
|
|
90
|
+
console.error(" about your stored credentials, OS keychain entries, or config dirs is");
|
|
91
|
+
console.error(" removed by the uninstall below.");
|
|
92
|
+
console.error("");
|
|
93
|
+
console.error(" To unblock, in this order:");
|
|
94
|
+
console.error("");
|
|
95
|
+
console.error(" npm uninstall -g @vibecodr/vc-tools");
|
|
96
|
+
console.error(" npm install -g @vibecodr/cli");
|
|
97
|
+
console.error("");
|
|
98
|
+
console.error(" After install, all three bin names work and resolve to the same");
|
|
99
|
+
console.error(" dispatcher: vibecodr, vibecodr-mcp, vc-tools.");
|
|
100
|
+
console.error("");
|
|
101
|
+
console.error(" Advanced opt-out (not recommended): set VIBECDR_SKIP_PREINSTALL_CHECK=1");
|
|
102
|
+
console.error(" and retry. The collision still trips an EEXIST inside npm; the env var");
|
|
103
|
+
console.error(" only silences this preflight check.");
|
|
104
|
+
console.error("");
|
|
105
|
+
console.error("==========================================================================");
|
|
106
|
+
console.error("");
|
|
107
|
+
process.exit(1);
|