vit 0.1.0 → 0.2.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/LICENSE +21 -661
- package/README.md +55 -78
- package/bin/vit.js +1 -1
- package/package.json +10 -3
- package/skills/vit/COMMANDS.md +270 -0
- package/skills/vit/SKILL.md +203 -0
- package/src/cli.js +13 -3
- package/src/cmd/adopt.js +1 -1
- package/src/cmd/beacon.js +3 -2
- package/src/cmd/config.js +7 -2
- package/src/cmd/doctor.js +143 -20
- package/src/cmd/explore.js +483 -0
- package/src/cmd/firehose.js +20 -9
- package/src/cmd/follow.js +63 -11
- package/src/cmd/hack.js +83 -0
- package/src/cmd/inbox.js +131 -0
- package/src/cmd/init.js +95 -13
- package/src/cmd/learn.js +262 -0
- package/src/cmd/link.js +75 -0
- package/src/cmd/login.js +95 -13
- package/src/cmd/remix.js +86 -37
- package/src/cmd/scan.js +209 -0
- package/src/cmd/ship.js +665 -149
- package/src/cmd/skim.js +140 -38
- package/src/cmd/vet.js +597 -97
- package/src/cmd/vouch.js +269 -89
- package/src/lib/agent.js +11 -1
- package/src/lib/beacon.js +1 -1
- package/src/lib/brand.js +1 -1
- package/src/lib/cap-ref.js +1 -1
- package/src/lib/compat.js +1 -1
- package/src/lib/config.js +11 -2
- package/src/lib/constants.js +4 -1
- package/src/lib/json-output.js +13 -0
- package/src/lib/oauth.js +49 -6
- package/src/lib/paths.js +1 -1
- package/src/lib/pds.js +79 -0
- package/src/lib/sandbox.js +1 -1
- package/src/lib/skill-ref.js +37 -0
- package/src/lib/trust-gate.js +39 -0
- package/src/lib/vit-dir.js +9 -1
- package/src/postinstall.js +26 -0
- package/src/cmd/setup.js +0 -76
package/src/cli.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
2
|
// Copyright (c) 2026 sol pbc
|
|
3
3
|
|
|
4
4
|
import { Command } from 'commander';
|
|
@@ -7,16 +7,21 @@ import registerAdopt from './cmd/adopt.js';
|
|
|
7
7
|
import registerBeacon from './cmd/beacon.js';
|
|
8
8
|
import registerConfig from './cmd/config.js';
|
|
9
9
|
import registerDoctor from './cmd/doctor.js';
|
|
10
|
+
import registerExplore from './cmd/explore.js';
|
|
10
11
|
import registerInit from './cmd/init.js';
|
|
12
|
+
import registerLearn from './cmd/learn.js';
|
|
11
13
|
import registerLogin from './cmd/login.js';
|
|
12
14
|
import registerFirehose from './cmd/firehose.js';
|
|
15
|
+
import registerScan from './cmd/scan.js';
|
|
13
16
|
import registerRemix from './cmd/remix.js';
|
|
14
17
|
import registerShip from './cmd/ship.js';
|
|
15
18
|
import registerSkim from './cmd/skim.js';
|
|
16
19
|
import registerVet from './cmd/vet.js';
|
|
17
20
|
import registerVouch from './cmd/vouch.js';
|
|
18
21
|
import registerFollow from './cmd/follow.js';
|
|
19
|
-
import
|
|
22
|
+
import registerHack from './cmd/hack.js';
|
|
23
|
+
import registerLink from './cmd/link.js';
|
|
24
|
+
import registerInbox from './cmd/inbox.js';
|
|
20
25
|
|
|
21
26
|
const program = new Command();
|
|
22
27
|
program
|
|
@@ -28,15 +33,20 @@ registerAdopt(program);
|
|
|
28
33
|
registerBeacon(program);
|
|
29
34
|
registerConfig(program);
|
|
30
35
|
registerDoctor(program);
|
|
36
|
+
registerExplore(program);
|
|
31
37
|
registerInit(program);
|
|
38
|
+
registerLearn(program);
|
|
32
39
|
registerLogin(program);
|
|
33
40
|
registerFirehose(program);
|
|
41
|
+
registerScan(program);
|
|
34
42
|
registerShip(program);
|
|
35
43
|
registerSkim(program);
|
|
36
44
|
registerRemix(program);
|
|
37
45
|
registerVet(program);
|
|
38
46
|
registerVouch(program);
|
|
39
47
|
registerFollow(program);
|
|
40
|
-
|
|
48
|
+
registerHack(program);
|
|
49
|
+
registerLink(program);
|
|
50
|
+
registerInbox(program);
|
|
41
51
|
|
|
42
52
|
export { program };
|
package/src/cmd/adopt.js
CHANGED
package/src/cmd/beacon.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
2
|
// Copyright (c) 2026 sol pbc
|
|
3
3
|
|
|
4
4
|
import git from 'isomorphic-git';
|
|
@@ -52,7 +52,8 @@ export default function register(program) {
|
|
|
52
52
|
if (beacon) {
|
|
53
53
|
console.log(`${mark} beacon: lit ${beacon}`);
|
|
54
54
|
} else {
|
|
55
|
-
console.log(`${mark} beacon: unlit
|
|
55
|
+
console.log(`${mark} beacon: unlit — this repo hasn't initialized vit yet.`);
|
|
56
|
+
console.log("the maintainer can light the beacon by running 'vit init' inside the repo.");
|
|
56
57
|
}
|
|
57
58
|
} catch (err) {
|
|
58
59
|
console.error(err instanceof Error ? err.message : String(err));
|
package/src/cmd/config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
2
|
// Copyright (c) 2026 sol pbc
|
|
3
3
|
|
|
4
4
|
import { loadConfig, saveConfig, getScalars } from '../lib/config.js';
|
|
@@ -23,7 +23,12 @@ export default function register(program) {
|
|
|
23
23
|
// Default to list when no action given
|
|
24
24
|
if (!action || action === 'list') {
|
|
25
25
|
const config = loadConfig();
|
|
26
|
-
|
|
26
|
+
const scalars = [...getScalars(config)];
|
|
27
|
+
if (scalars.length === 0) {
|
|
28
|
+
console.log("no configuration set. run 'vit login <handle>' to get started.");
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
for (const [k, v] of scalars) {
|
|
27
32
|
console.log(`${k}=${v}`);
|
|
28
33
|
}
|
|
29
34
|
return;
|
package/src/cmd/doctor.js
CHANGED
|
@@ -1,59 +1,182 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
2
|
// Copyright (c) 2026 sol pbc
|
|
3
3
|
|
|
4
4
|
import { loadConfig } from '../lib/config.js';
|
|
5
5
|
import { restoreAgent } from '../lib/oauth.js';
|
|
6
6
|
import { readProjectConfig } from '../lib/vit-dir.js';
|
|
7
|
-
import { existsSync } from 'node:fs';
|
|
7
|
+
import { existsSync, lstatSync, readdirSync, readFileSync } from 'node:fs';
|
|
8
8
|
import { join } from 'node:path';
|
|
9
|
+
import { homedir } from 'node:os';
|
|
9
10
|
import { mark, name } from '../lib/brand.js';
|
|
11
|
+
import { which } from '../lib/compat.js';
|
|
12
|
+
import { jsonOk, jsonError } from '../lib/json-output.js';
|
|
13
|
+
import { configPath } from '../lib/paths.js';
|
|
14
|
+
|
|
15
|
+
function scanSkillDir(dir) {
|
|
16
|
+
const skills = [];
|
|
17
|
+
if (!existsSync(dir)) return skills;
|
|
18
|
+
try {
|
|
19
|
+
const entries = readdirSync(dir, { withFileTypes: true });
|
|
20
|
+
for (const entry of entries) {
|
|
21
|
+
if (!entry.isDirectory()) continue;
|
|
22
|
+
const skillMd = join(dir, entry.name, 'SKILL.md');
|
|
23
|
+
if (existsSync(skillMd)) {
|
|
24
|
+
let version = null;
|
|
25
|
+
try {
|
|
26
|
+
const content = readFileSync(skillMd, 'utf-8');
|
|
27
|
+
const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
28
|
+
if (match) {
|
|
29
|
+
const versionMatch = match[1].match(/^version:\s*(.+)$/m);
|
|
30
|
+
if (versionMatch) version = versionMatch[1].trim();
|
|
31
|
+
}
|
|
32
|
+
} catch { /* ignore read errors */ }
|
|
33
|
+
skills.push({ name: entry.name, version });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
} catch { /* ignore dir read errors */ }
|
|
37
|
+
return skills;
|
|
38
|
+
}
|
|
10
39
|
|
|
11
40
|
export default function register(program) {
|
|
12
|
-
async function checkHealth() {
|
|
41
|
+
async function checkHealth(opts) {
|
|
13
42
|
try {
|
|
14
43
|
const config = loadConfig();
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
44
|
+
let installType = 'not on PATH';
|
|
45
|
+
let vitPath = which(name);
|
|
46
|
+
let installPath = vitPath || null;
|
|
47
|
+
let beacon = null;
|
|
48
|
+
let skillInstalled = false;
|
|
49
|
+
let projectSkills = [];
|
|
50
|
+
let userSkills = [];
|
|
51
|
+
let blueskyOk = false;
|
|
52
|
+
let pds = null;
|
|
53
|
+
|
|
54
|
+
if (!vitPath) {
|
|
55
|
+
installType = 'not on PATH';
|
|
56
|
+
if (!opts.json) console.log(`${mark} install: not on PATH`);
|
|
18
57
|
} else {
|
|
19
|
-
|
|
58
|
+
try {
|
|
59
|
+
if (lstatSync(vitPath).isSymbolicLink()) {
|
|
60
|
+
installType = 'linked';
|
|
61
|
+
if (!opts.json) console.log(`${mark} install: linked (${vitPath})`);
|
|
62
|
+
} else if (vitPath.includes('node_modules')) {
|
|
63
|
+
installType = 'global';
|
|
64
|
+
if (!opts.json) console.log(`${mark} install: global`);
|
|
65
|
+
} else {
|
|
66
|
+
installType = 'source';
|
|
67
|
+
if (!opts.json) console.log(`${mark} install: source (${vitPath})`);
|
|
68
|
+
}
|
|
69
|
+
} catch {
|
|
70
|
+
installType = 'source';
|
|
71
|
+
if (!opts.json) console.log(`${mark} install: source (${vitPath})`);
|
|
72
|
+
}
|
|
20
73
|
}
|
|
21
74
|
|
|
22
75
|
const projConfig = readProjectConfig();
|
|
76
|
+
beacon = projConfig.beacon || null;
|
|
23
77
|
if (projConfig.beacon) {
|
|
24
|
-
console.log(`${mark} beacon: ${projConfig.beacon}`);
|
|
78
|
+
if (!opts.json) console.log(`${mark} beacon: ${projConfig.beacon}`);
|
|
25
79
|
} else {
|
|
26
|
-
console.log(`${mark} beacon: not set`);
|
|
80
|
+
if (!opts.json) console.log(`${mark} beacon: not set (run vit init)`);
|
|
27
81
|
}
|
|
28
82
|
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
83
|
+
const projectSkillPath = join(process.cwd(), '.claude', 'skills', 'using-vit', 'SKILL.md');
|
|
84
|
+
const userSkillPath = join(homedir(), '.claude', 'skills', 'using-vit', 'SKILL.md');
|
|
85
|
+
skillInstalled = existsSync(projectSkillPath) || existsSync(userSkillPath);
|
|
86
|
+
if (skillInstalled) {
|
|
87
|
+
if (!opts.json) console.log(`${mark} skill: ok (using-vit)`);
|
|
32
88
|
} else {
|
|
33
|
-
console.log(`${mark} skill: not installed (
|
|
89
|
+
if (!opts.json) console.log(`${mark} skill: not installed (reinstall vit)`);
|
|
34
90
|
}
|
|
35
91
|
|
|
36
|
-
|
|
37
|
-
|
|
92
|
+
// Report installed skills
|
|
93
|
+
const projectSkillDir = join(process.cwd(), '.claude', 'skills');
|
|
94
|
+
projectSkills = scanSkillDir(projectSkillDir);
|
|
95
|
+
const userSkillDir = join(homedir(), '.claude', 'skills');
|
|
96
|
+
userSkills = scanSkillDir(userSkillDir);
|
|
97
|
+
|
|
98
|
+
if (!opts.json && projectSkills.length > 0) {
|
|
99
|
+
console.log(`${mark} project skills: ${projectSkills.length} installed`);
|
|
100
|
+
for (const s of projectSkills) {
|
|
101
|
+
const ver = s.version ? ` v${s.version}` : '';
|
|
102
|
+
console.log(` ${s.name}${ver}`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (!opts.json && userSkills.length > 0) {
|
|
106
|
+
console.log(`${mark} user skills: ${userSkills.length} installed`);
|
|
107
|
+
for (const s of userSkills) {
|
|
108
|
+
const ver = s.version ? ` v${s.version}` : '';
|
|
109
|
+
console.log(` ${s.name}${ver}`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
let effectiveDid = config.did;
|
|
114
|
+
let identitySource = effectiveDid ? 'global' : null;
|
|
115
|
+
let authType = 'oauth';
|
|
116
|
+
|
|
117
|
+
const localLoginPath = join(process.cwd(), '.vit', 'login.json');
|
|
118
|
+
try {
|
|
119
|
+
if (existsSync(localLoginPath)) {
|
|
120
|
+
const local = JSON.parse(readFileSync(localLoginPath, 'utf-8'));
|
|
121
|
+
if (local.did) {
|
|
122
|
+
effectiveDid = local.did;
|
|
123
|
+
identitySource = 'local';
|
|
124
|
+
authType = local.type || 'oauth';
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
} catch {}
|
|
128
|
+
|
|
129
|
+
if (!identitySource && effectiveDid) identitySource = 'global';
|
|
130
|
+
|
|
131
|
+
if (identitySource === 'global' && effectiveDid) {
|
|
132
|
+
try {
|
|
133
|
+
const raw = readFileSync(configPath('session.json'), 'utf-8');
|
|
134
|
+
const sessionData = JSON.parse(raw);
|
|
135
|
+
if (sessionData[effectiveDid]?.type === 'app-password') authType = 'app-password';
|
|
136
|
+
} catch {}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (!effectiveDid) {
|
|
140
|
+
if (!opts.json) console.log(`${mark} bluesky: not logged in (run ${name} login <handle>)`);
|
|
38
141
|
} else {
|
|
39
142
|
try {
|
|
40
|
-
const { session } = await restoreAgent(
|
|
41
|
-
|
|
42
|
-
|
|
143
|
+
const { session } = await restoreAgent(effectiveDid);
|
|
144
|
+
blueskyOk = true;
|
|
145
|
+
pds = session.serverMetadata?.issuer || null;
|
|
146
|
+
if (!opts.json) console.log(`${mark} bluesky: ok (${session.did || effectiveDid}${pds ? ', ' + pds : ''})`);
|
|
43
147
|
} catch {
|
|
44
|
-
console.log(`${mark} bluesky: token expired or invalid (run ${name} login <handle>)`);
|
|
148
|
+
if (!opts.json) console.log(`${mark} bluesky: token expired or invalid (run ${name} login <handle>)`);
|
|
45
149
|
}
|
|
150
|
+
if (!opts.json) console.log(`${mark} identity: ${identitySource} (${authType})`);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (opts.json) {
|
|
154
|
+
jsonOk({
|
|
155
|
+
install: { type: installType, path: installPath },
|
|
156
|
+
beacon,
|
|
157
|
+
skill: skillInstalled,
|
|
158
|
+
projectSkills,
|
|
159
|
+
userSkills,
|
|
160
|
+
bluesky: { ok: blueskyOk, did: effectiveDid || null, pds, source: identitySource, authType },
|
|
161
|
+
});
|
|
46
162
|
}
|
|
47
163
|
} catch (err) {
|
|
48
|
-
|
|
164
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
165
|
+
if (opts.json) {
|
|
166
|
+
jsonError(msg);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
console.error(msg);
|
|
49
170
|
process.exitCode = 1;
|
|
50
171
|
}
|
|
51
172
|
}
|
|
52
173
|
|
|
53
174
|
program.command('doctor')
|
|
54
175
|
.description('Verify vit environment and project configuration')
|
|
176
|
+
.option('--json', 'Output as JSON')
|
|
55
177
|
.action(checkHealth);
|
|
56
178
|
program.command('status')
|
|
57
179
|
.description('Alias for doctor')
|
|
180
|
+
.option('--json', 'Output as JSON')
|
|
58
181
|
.action(checkHealth);
|
|
59
182
|
}
|