Lines 2206-2246javascript
2206 if (since && cmpSemver(m[1], since) <= 0)
2213 return out.join('\n').trim();
2215// ---------- update: bring the CLI + installed surfaces to the latest ----------
2216// pkgVersion reads the version of the package the running CLI belongs to.
2217// dirname(CLI_PATH) is pkg/src (repo checkout) or <pkg>/dist (npm install) —
2218// package.json sits one level up in both layouts.
2219function pkgVersion() {
2221 return String(JSON.parse(readFileSync(join(dirname(CLI_PATH), '..', 'package.json'), 'utf8')).version || '');
2224 return ''; // no package.json next to the CLI (odd layout) — version is cosmetic here
2227// updateCmd updates the CLI source (git pull in a repo checkout, `npm i -g` for
2228// a global npm install — detected from where the running file lives), then
2229// refreshes every surface a previous install put on this machine: the skills
2230// bundle (+ /vitrinka:listen command stub) and, ONLY where it was consented to
2231// before, the Claude Code UI wiring. It never asks new consent questions —
2232// that stays `vitrinka install`'s job. The refresh steps re-exec the (possibly
2233// just replaced) CLI file so they run the NEW code, not this stale process.
2234async function updateCmd(_args) {
2235 const repoTop = git(['rev-parse', '--show-toplevel'], dirname(CLI_PATH));
2237 // Repo checkout — the shim/MCP run the source directly, so a pull IS the update.
2238 const before = git(['rev-parse', '--short', 'HEAD'], repoTop);
2239 console.log(`repo checkout ${repoTop} (${before || '?'}) — git pull --ff-only…`);
2240 const pull = spawnSync('git', ['-C', repoTop, 'pull', '--ff-only'], { stdio: 'inherit' });
2241 if (pull.status !== 0)
HighRuntime Package Install
Package source invokes a package manager install command at runtime.
dist/cli.jsView on unpkg · L2226 2242 fail('update: git pull --ff-only failed — fix the repo state (dirty tree / diverged branch) and re-run');
2243 const after = git(['rev-parse', '--short', 'HEAD'], repoTop);
2244 if (after === before)
2245 console.log(`✓ already up to date (${after})`);