vit 0.4.3 → 0.5.0
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 +1 -1
- package/skills/vit/COMMANDS.md +1 -1
- package/skills/vit/SKILL.md +1 -1
- package/src/cli.js +4 -1
- package/src/cmd/doctor.js +31 -7
- package/src/cmd/learn.js +2 -1
- package/src/cmd/login.js +13 -0
- package/src/lib/skill-install.js +103 -0
- package/src/postinstall.js +5 -19
package/package.json
CHANGED
package/skills/vit/COMMANDS.md
CHANGED
|
@@ -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.
|
package/skills/vit/SKILL.md
CHANGED
|
@@ -67,7 +67,7 @@ Handoffs:
|
|
|
67
67
|
### Agent-usable commands
|
|
68
68
|
|
|
69
69
|
### `vit doctor`
|
|
70
|
-
- Description:
|
|
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(
|
|
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
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
-
|
|
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(
|
|
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/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();
|
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();
|
|
@@ -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
|
+
}
|
package/src/postinstall.js
CHANGED
|
@@ -1,26 +1,12 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
// Copyright (c) 2026 sol pbc
|
|
3
3
|
|
|
4
|
-
import {
|
|
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
|
|
10
|
-
|
|
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);
|