···11-.PHONY: install install-user test test-node clean
11+.PHONY: install link test test-node clean
2233install:
44 bun install
5566-install-user:
77- bun link
66+link:
77+ bun install && node bin/vit.js link
8899test: test-node
1010 bun test
+42
hack
···11+#!/bin/sh
22+set -e
33+44+SELF="solpbc/vit"
55+66+command_exists() {
77+ command -v "$1" >/dev/null 2>&1
88+}
99+1010+echo "installing vit from source ($SELF)..."
1111+1212+if ! command_exists git; then
1313+ echo "error: git is required. install git and try again."
1414+ exit 1
1515+fi
1616+1717+if ! command_exists bun; then
1818+ echo "bun not found, installing..."
1919+ curl -fsSL https://bun.sh/install | bash
2020+ export BUN_INSTALL="$HOME/.bun"
2121+ export PATH="$BUN_INSTALL/bin:$PATH"
2222+fi
2323+2424+DIR_NAME=$(echo "$SELF" | sed 's|.*/||')
2525+if [ -d "$DIR_NAME" ]; then
2626+ echo "$DIR_NAME/ already exists, skipping clone"
2727+else
2828+ if command_exists gh; then
2929+ gh repo clone "$SELF" "$DIR_NAME"
3030+ else
3131+ git clone "https://github.com/$SELF.git" "$DIR_NAME"
3232+ fi
3333+fi
3434+3535+cd "$DIR_NAME"
3636+3737+bun install
3838+node bin/vit.js link
3939+4040+echo ""
4141+echo "vit installed from source"
4242+echo "run: cd $DIR_NAME"
+4
src/cli.js
···1717import registerVouch from './cmd/vouch.js';
1818import registerFollow from './cmd/follow.js';
1919import registerSetup from './cmd/setup.js';
2020+import registerHack from './cmd/hack.js';
2121+import registerLink from './cmd/link.js';
20222123const program = new Command();
2224program
···3840registerVouch(program);
3941registerFollow(program);
4042registerSetup(program);
4343+registerHack(program);
4444+registerLink(program);
41454246export { program };
+19-1
src/cmd/doctor.js
···44import { loadConfig } from '../lib/config.js';
55import { restoreAgent } from '../lib/oauth.js';
66import { readProjectConfig } from '../lib/vit-dir.js';
77-import { existsSync } from 'node:fs';
77+import { existsSync, lstatSync } from 'node:fs';
88import { join } from 'node:path';
99import { mark, name } from '../lib/brand.js';
1010+import { which } from '../lib/compat.js';
10111112export default function register(program) {
1213 async function checkHealth() {
···1718 console.log(`${mark} setup: ok (${when})`);
1819 } else {
1920 console.log(`${mark} setup: not done (run ${name} setup)`);
2121+ }
2222+2323+ const vitPath = which(name);
2424+ if (!vitPath) {
2525+ console.log(`${mark} install: not on PATH`);
2626+ } else {
2727+ try {
2828+ if (lstatSync(vitPath).isSymbolicLink()) {
2929+ console.log(`${mark} install: linked (${vitPath})`);
3030+ } else if (vitPath.includes('node_modules')) {
3131+ console.log(`${mark} install: global`);
3232+ } else {
3333+ console.log(`${mark} install: source (${vitPath})`);
3434+ }
3535+ } catch {
3636+ console.log(`${mark} install: source (${vitPath})`);
3737+ }
2038 }
21392240 const projConfig = readProjectConfig();