vit 0.4.3 → 0.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vit",
3
- "version": "0.4.3",
3
+ "version": "0.5.1",
4
4
  "description": "Social toolkit for personalized software",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -57,7 +57,7 @@ Options:
57
57
  - None.
58
58
 
59
59
  Output format:
60
- - Text diagnostics for install and beacon status.
60
+ - Text diagnostics for install and beacon status; self-installs the using-vit skill into `~/.claude/skills` and `~/.agents/skills` if missing.
61
61
 
62
62
  Error conditions:
63
63
  - Config read/parse failures.
@@ -11,7 +11,7 @@ description: >-
11
11
 
12
12
  ## 1. Overview
13
13
 
14
- vit is a Bun CLI for social software capabilities. Agents use it to initialize projects, follow accounts, skim caps from followed accounts, and ship new caps. Some commands (login, adopt, vet) require human interaction - the agent should tell the user to run those in their terminal.
14
+ vit is a Node CLI for social software capabilities. Agents use it to initialize projects, follow accounts, skim caps from followed accounts, and ship new caps. Some commands (login, adopt, vet) require human interaction - the agent should tell the user to run those in their terminal.
15
15
 
16
16
  ## 2. Prerequisites
17
17
 
@@ -67,7 +67,7 @@ Handoffs:
67
67
  ### Agent-usable commands
68
68
 
69
69
  ### `vit doctor`
70
- - Description: Read-only diagnostic for install and beacon status.
70
+ - Description: Verify install and beacon status, and self-install the using-vit skill into `~/.claude/skills` and `~/.agents/skills` if missing.
71
71
  - Usage: `vit doctor`
72
72
  - Key flags: none.
73
73
  - Output: text status lines for install and beacon.
package/src/cli.js CHANGED
@@ -2,6 +2,7 @@
2
2
  // Copyright (c) 2026 sol pbc
3
3
 
4
4
  import { Command } from 'commander';
5
+ import { readFileSync } from 'node:fs';
5
6
  import { brand } from './lib/brand.js';
6
7
  import registerAdopt from './cmd/adopt.js';
7
8
  import registerBeacon from './cmd/beacon.js';
@@ -23,11 +24,13 @@ import registerHack from './cmd/hack.js';
23
24
  import registerLink from './cmd/link.js';
24
25
  import registerInbox from './cmd/inbox.js';
25
26
 
27
+ const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf-8'));
28
+
26
29
  const program = new Command();
27
30
  program
28
31
  .name('vit')
29
32
  .description(`${brand} \u2014 social open source`)
30
- .version('0.1.0');
33
+ .version(pkg.version);
31
34
 
32
35
  registerAdopt(program);
33
36
  registerBeacon(program);
package/src/cmd/doctor.js CHANGED
@@ -12,6 +12,9 @@ import { which } from '../lib/compat.js';
12
12
  import { jsonOk, jsonError } from '../lib/json-output.js';
13
13
  import { configPath } from '../lib/paths.js';
14
14
  import { errorMessage, formatError } from '../lib/error-format.js';
15
+ import { ensureSkill, skillInstallReason } from '../lib/skill-install.js';
16
+
17
+ const USING_VIT_SKILL = 'using-vit';
15
18
 
16
19
  function scanSkillDir(dir) {
17
20
  const skills = [];
@@ -42,6 +45,18 @@ function scanSkillDir(dir) {
42
45
  return skills;
43
46
  }
44
47
 
48
+ function formatSkillLine(skillResult) {
49
+ if (skillResult.ok) {
50
+ const paths = skillResult.results.map(result => result.path).join(', ');
51
+ if (skillResult.results.every(result => result.status === 'already-present')) {
52
+ return `${mark} skill: ok (${USING_VIT_SKILL})`;
53
+ }
54
+ return `${mark} skill: installed (${USING_VIT_SKILL}) → ${paths}`;
55
+ }
56
+
57
+ return `${mark} skill: install failed — ${skillInstallReason(skillResult)}; check write permissions on ~/.claude and ~/.agents, or reinstall vit`;
58
+ }
59
+
45
60
  export default function register(program) {
46
61
  async function checkHealth(opts) {
47
62
  try {
@@ -86,19 +101,23 @@ export default function register(program) {
86
101
  if (!opts.json) console.log(`${mark} beacon: not set (run vit init)`);
87
102
  }
88
103
 
89
- const projectSkillPath = join(process.cwd(), '.claude', 'skills', 'using-vit', 'SKILL.md');
90
- const userSkillPath = join(homedir(), '.claude', 'skills', 'using-vit', 'SKILL.md');
91
- skillInstalled = existsSync(projectSkillPath) || existsSync(userSkillPath);
92
- if (skillInstalled) {
93
- if (!opts.json) console.log(`${mark} skill: ok (using-vit)`);
104
+ const skillResult = ensureSkill();
105
+ const home = homedir();
106
+ const projectClaude = join(process.cwd(), '.claude', 'skills', USING_VIT_SKILL, 'SKILL.md');
107
+ const userClaude = join(home, '.claude', 'skills', USING_VIT_SKILL, 'SKILL.md');
108
+ const userAgents = join(home, '.agents', 'skills', USING_VIT_SKILL, 'SKILL.md');
109
+ skillInstalled = existsSync(projectClaude) || existsSync(userClaude) || existsSync(userAgents);
110
+ const skillLine = formatSkillLine(skillResult);
111
+ if (opts.json) {
112
+ console.error(skillLine);
94
113
  } else {
95
- if (!opts.json) console.log(`${mark} skill: not installed (reinstall vit)`);
114
+ console.log(skillLine);
96
115
  }
97
116
 
98
117
  // Report installed skills
99
118
  const projectSkillDir = join(process.cwd(), '.claude', 'skills');
100
119
  projectSkills = scanSkillDir(projectSkillDir);
101
- const userSkillDir = join(homedir(), '.claude', 'skills');
120
+ const userSkillDir = join(home, '.claude', 'skills');
102
121
  userSkills = scanSkillDir(userSkillDir);
103
122
 
104
123
  if (!opts.json && projectSkills.length > 0) {
@@ -169,6 +188,7 @@ export default function register(program) {
169
188
  install: { type: installType, path: installPath },
170
189
  beacon,
171
190
  skill: skillInstalled,
191
+ skillInstall: { ok: skillResult.ok, results: skillResult.results },
172
192
  projectSkills,
173
193
  userSkills,
174
194
  bluesky: { ok: blueskyOk, did: effectiveDid || null, pds, source: identitySource, authType },
@@ -192,4 +212,8 @@ export default function register(program) {
192
212
  .description('Alias for doctor')
193
213
  .option('--json', 'Output as JSON')
194
214
  .action(checkHealth);
215
+ program.command('setup')
216
+ .description('Alias for doctor')
217
+ .option('--json', 'Output as JSON')
218
+ .action(checkHealth);
195
219
  }
package/src/cmd/init.js CHANGED
@@ -27,7 +27,7 @@ export default function register(program) {
27
27
  jsonError('agent required', 'run vit init from a coding agent');
28
28
  return;
29
29
  }
30
- console.error(`${name} init should be run by a coding agent (e.g. claude code, gemini cli).`);
30
+ console.error(`${name} init should be run by a coding agent (e.g. claude code, codex, gemini cli, opencode).`);
31
31
  console.error(`open your agent and ask it to run '${name} init' for you.`);
32
32
  process.exitCode = 1;
33
33
  return;
package/src/cmd/learn.js CHANGED
@@ -54,11 +54,12 @@ async function installSkill({ match, skillName, isGlobal, opts, ref }) {
54
54
  }
55
55
  }
56
56
 
57
- const addArgs = ['skills', 'add', tempDir, '-a', 'claude-code', '-y'];
57
+ const addArgs = ['--yes', 'skills', 'add', tempDir, '-a', 'claude-code', '-y'];
58
58
  if (isGlobal) addArgs.push('-g');
59
59
  const addResult = spawnSync('npx', addArgs, {
60
60
  encoding: 'utf-8',
61
61
  stdio: ['pipe', 'pipe', 'pipe'],
62
+ env: { ...process.env, CI: 'true' },
62
63
  });
63
64
  if (addResult.status !== 0) {
64
65
  const errText = (addResult.stderr || addResult.stdout || '').trim();
@@ -246,7 +247,7 @@ Examples:
246
247
  jsonError('agent required', 'run vit learn from a coding agent');
247
248
  return;
248
249
  }
249
- console.error(`${name} learn should be run by a coding agent (e.g. claude code, gemini cli).`);
250
+ console.error(`${name} learn should be run by a coding agent (e.g. claude code, codex, gemini cli, opencode).`);
250
251
  console.error(`open your agent and ask it to run '${name} learn' for you.`);
251
252
  process.exitCode = 1;
252
253
  return;
package/src/cmd/login.js CHANGED
@@ -12,6 +12,8 @@ import { createOAuthClient, createSessionStore, createStore, checkSession } from
12
12
  import { configDir, configPath } from '../lib/paths.js';
13
13
  import { vitDir } from '../lib/vit-dir.js';
14
14
  import { errorMessage, formatError } from '../lib/error-format.js';
15
+ import { mark } from '../lib/brand.js';
16
+ import { ensureSkill, skillInstallReason } from '../lib/skill-install.js';
15
17
 
16
18
  export const LOGIN_COMMON_ISSUES_FOOTER = `Common issues:
17
19
  - make sure the handle is correct and resolves on Bluesky
@@ -65,6 +67,15 @@ export function printLoginFailure(err, { verbose = false, includeFooter = false
65
67
  }
66
68
  }
67
69
 
70
+ function printSkillReadiness(skillResult) {
71
+ if (skillResult.ok) {
72
+ console.log(`${mark} skill: ready (using-vit)`);
73
+ return;
74
+ }
75
+
76
+ console.log(`${mark} skill: install failed — ${skillInstallReason(skillResult)}; check write permissions on ~/.claude and ~/.agents, or reinstall vit`);
77
+ }
78
+
68
79
  export default function register(program) {
69
80
  program
70
81
  .command('login')
@@ -80,6 +91,8 @@ export default function register(program) {
80
91
  const { verbose, force, remote, browser, appPassword, local: localLogin } = opts;
81
92
  const isRemote = remote || !!(process.env.SSH_CONNECTION || process.env.SSH_TTY || process.env.SSH_CLIENT);
82
93
  handle = handle.replace(/^@/, '');
94
+ const skillResult = ensureSkill();
95
+ printSkillReadiness(skillResult);
83
96
 
84
97
  if (localLogin) {
85
98
  const dir = vitDir();
package/src/cmd/remix.js CHANGED
@@ -30,7 +30,7 @@ export default function register(program) {
30
30
  jsonError('agent required', 'run vit remix from a coding agent');
31
31
  return;
32
32
  }
33
- console.error(`${name} remix should be run by a coding agent (e.g. claude code, gemini cli).`);
33
+ console.error(`${name} remix should be run by a coding agent (e.g. claude code, codex, gemini cli, opencode).`);
34
34
  console.error(`open your agent and ask it to run '${name} remix' for you.`);
35
35
  process.exitCode = 1;
36
36
  return;
package/src/cmd/ship.js CHANGED
@@ -143,7 +143,7 @@ async function shipSkill(opts) {
143
143
  jsonError('agent required', 'run vit ship --skill from a coding agent');
144
144
  return;
145
145
  }
146
- console.error(`${name} ship --skill should be run by a coding agent (e.g. claude code, gemini cli).`);
146
+ console.error(`${name} ship --skill should be run by a coding agent (e.g. claude code, codex, gemini cli, opencode).`);
147
147
  console.error(`open your agent and ask it to run '${name} ship --skill' for you.`);
148
148
  process.exitCode = 1;
149
149
  return;
@@ -352,7 +352,7 @@ async function shipCap(opts) {
352
352
  jsonError('agent required', 'run vit ship from a coding agent');
353
353
  return;
354
354
  }
355
- console.error(`${name} ship should be run by a coding agent (e.g. claude code, gemini cli).`);
355
+ console.error(`${name} ship should be run by a coding agent (e.g. claude code, codex, gemini cli, opencode).`);
356
356
  console.error(`open your agent and ask it to run '${name} ship' for you.`);
357
357
  console.error(`refer to the using-vit skill (skills/vit/SKILL.md) for a shipping guide.`);
358
358
  process.exitCode = 1;
package/src/cmd/skim.js CHANGED
@@ -29,7 +29,7 @@ export default function register(program) {
29
29
  try {
30
30
  const gate = requireAgent();
31
31
  if (!gate.ok) {
32
- console.error(`${name} skim should be run by a coding agent (e.g. claude code, gemini cli).`);
32
+ console.error(`${name} skim should be run by a coding agent (e.g. claude code, codex, gemini cli, opencode).`);
33
33
  console.error(`open your agent and ask it to run '${name} skim' for you.`);
34
34
  process.exitCode = 1;
35
35
  return;
package/src/lib/agent.js CHANGED
@@ -5,6 +5,7 @@ const CODING_AGENTS = {
5
5
  CLAUDECODE: 'claude code',
6
6
  GEMINI_CLI: 'gemini cli',
7
7
  CODEX_CI: 'codex',
8
+ OPENCODE: 'opencode',
8
9
  };
9
10
 
10
11
  export function detectCodingAgent() {
@@ -0,0 +1,103 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright (c) 2026 sol pbc
3
+
4
+ import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync } from 'node:fs';
5
+ import { homedir } from 'node:os';
6
+ import { dirname, join } from 'node:path';
7
+ import { fileURLToPath } from 'node:url';
8
+
9
+ const DEFAULT_SKILL_NAME = 'using-vit';
10
+ const SOURCE_MISSING_ERROR = 'source skill files missing or empty';
11
+
12
+ function defaultSourceDir() {
13
+ return join(dirname(fileURLToPath(import.meta.url)), '..', '..', 'skills', 'vit');
14
+ }
15
+
16
+ function errorMessage(err) {
17
+ if (err instanceof Error) return err.message || String(err);
18
+ return String(err);
19
+ }
20
+
21
+ function readSkillName(sourceDir) {
22
+ try {
23
+ const content = readFileSync(join(sourceDir, 'SKILL.md'), 'utf-8');
24
+ const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
25
+ if (!match) return DEFAULT_SKILL_NAME;
26
+ const nameMatch = match[1].match(/^name:\s*(.+)$/m);
27
+ return nameMatch ? nameMatch[1].trim() : DEFAULT_SKILL_NAME;
28
+ } catch {
29
+ return DEFAULT_SKILL_NAME;
30
+ }
31
+ }
32
+
33
+ function sourceExists(sourceDir) {
34
+ try {
35
+ return existsSync(sourceDir) && readdirSync(sourceDir).length > 0;
36
+ } catch {
37
+ return false;
38
+ }
39
+ }
40
+
41
+ export function skillInstallReason(skillResult) {
42
+ if (skillResult.results.some(result => result.status === 'source-missing')) {
43
+ return 'source skill files missing';
44
+ }
45
+
46
+ const failed = skillResult.results.filter(result => result.status === 'failed');
47
+ if (failed.length > 0) {
48
+ return failed
49
+ .map(result => `${result.label} failed: ${result.error || 'unknown error'}`)
50
+ .join('; ');
51
+ }
52
+
53
+ return 'skill install failed';
54
+ }
55
+
56
+ // sourceDir exists only as a test seam; production callers pass nothing.
57
+ export function ensureSkill({ sourceDir = defaultSourceDir() } = {}) {
58
+ const name = readSkillName(sourceDir);
59
+ const home = homedir();
60
+ const targets = [
61
+ { label: 'claude', path: join(home, '.claude', 'skills', name) },
62
+ { label: 'agents', path: join(home, '.agents', 'skills', name) },
63
+ ];
64
+
65
+ if (!sourceExists(sourceDir)) {
66
+ return {
67
+ name,
68
+ source: null,
69
+ ok: false,
70
+ results: targets.map(target => ({
71
+ ...target,
72
+ status: 'source-missing',
73
+ error: SOURCE_MISSING_ERROR,
74
+ })),
75
+ };
76
+ }
77
+
78
+ const results = targets.map(target => {
79
+ try {
80
+ const existed = existsSync(join(target.path, 'SKILL.md'));
81
+ mkdirSync(target.path, { recursive: true });
82
+ cpSync(sourceDir, target.path, { recursive: true, force: true });
83
+ return {
84
+ ...target,
85
+ status: existed ? 'already-present' : 'created',
86
+ error: null,
87
+ };
88
+ } catch (err) {
89
+ return {
90
+ ...target,
91
+ status: 'failed',
92
+ error: errorMessage(err),
93
+ };
94
+ }
95
+ });
96
+
97
+ return {
98
+ name,
99
+ source: sourceDir,
100
+ ok: results.every(result => result.status === 'created' || result.status === 'already-present'),
101
+ results,
102
+ };
103
+ }
@@ -1,26 +1,12 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  // Copyright (c) 2026 sol pbc
3
3
 
4
- import { spawnSync } from 'node:child_process';
5
- import { dirname, join } from 'node:path';
6
- import { fileURLToPath } from 'node:url';
4
+ import { ensureSkill } from './lib/skill-install.js';
7
5
 
8
6
  try {
9
- const currentFile = fileURLToPath(import.meta.url);
10
- const currentDir = dirname(currentFile);
11
- const skillDir = join(currentDir, '..', 'skills', 'vit');
12
- const result = spawnSync(
13
- 'npx',
14
- ['skills', 'add', skillDir, '-g', '-a', 'claude-code', '-y'],
15
- {
16
- encoding: 'utf-8',
17
- stdio: ['pipe', 'pipe', 'pipe'],
18
- }
19
- );
20
-
21
- if (result.status === 0) {
22
- console.log('vit: skill installed (using-vit)');
23
- }
7
+ const r = ensureSkill();
8
+ if (r.ok) console.log('vit: using-vit skill installed');
24
9
  } catch {
25
- process.exit(0);
26
10
  }
11
+
12
+ process.exit(0);