vit 0.1.3 → 0.3.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/src/cmd/vet.js CHANGED
@@ -179,7 +179,7 @@ export default function register(program) {
179
179
  console.log(' caps and skills in this project.');
180
180
  console.log('');
181
181
  console.log(' any agent running in this project can remix caps and learn skills');
182
- console.log(' without human review. only do this if you trust the agent\'s judgment');
182
+ console.log(' without operator review. only do this if you trust the agent\'s judgment');
183
183
  console.log(' and the network sources you follow.');
184
184
  console.log('');
185
185
  console.log(' to proceed, confirm: vit vet --dangerous-accept --confirm');
@@ -230,10 +230,10 @@ export default function register(program) {
230
230
  // Sandboxed sub-agent pattern — allow it
231
231
  } else {
232
232
  if (opts.json) {
233
- jsonError('vit vet is for human review', 'use --trust --confirm to bypass');
233
+ jsonError('vit vet is for operator review', 'use --trust --confirm to bypass');
234
234
  return;
235
235
  }
236
- console.error('vit vet is for human review. agents should not vet directly.');
236
+ console.error('vit vet is for operator review. agents should not vet directly.');
237
237
  console.error('');
238
238
  console.error('if you are a sandboxed sub-agent specifically tasked with vetting,');
239
239
  console.error('you can bypass this gate:');
@@ -305,6 +305,10 @@ export default function register(program) {
305
305
  return;
306
306
  }
307
307
  console.error(`no cap found with ref '${ref}' for this beacon.`);
308
+ console.error('');
309
+ console.error('hint: caps only appear from accounts you follow and your own.');
310
+ console.error(` vit following check who you're following`);
311
+ console.error(` vit explore cap ${ref} search the network-wide index`);
308
312
  process.exitCode = 1;
309
313
  return;
310
314
  }
@@ -370,7 +374,20 @@ export default function register(program) {
370
374
  return;
371
375
  }
372
376
 
377
+ const isRequestCap = record.kind === 'request';
378
+
373
379
  if (opts.trust) {
380
+ if (isRequestCap) {
381
+ if (opts.json) {
382
+ jsonOk({ trusted: false, ref, uri: match.uri, note: 'request caps cannot be trusted — vouch with --kind want to signal demand' });
383
+ return;
384
+ }
385
+ console.log(`this is a request cap — there is nothing to trust or apply.`);
386
+ console.log(`to signal demand, run:`);
387
+ console.log('');
388
+ console.log(` vit vouch ${ref} --kind want`);
389
+ return;
390
+ }
374
391
  appendLog('trusted.jsonl', {
375
392
  ref,
376
393
  uri: match.uri,
@@ -390,14 +407,19 @@ export default function register(program) {
390
407
  const text = record.text || '';
391
408
 
392
409
  if (opts.json) {
393
- jsonOk({ ref, type: 'cap', author, title, description, text });
410
+ jsonOk({ ref, type: 'cap', author, title, description, text, ...(record.kind && { kind: record.kind }) });
394
411
  return;
395
412
  }
396
413
 
397
414
  console.log(`=== ${brand} cap review ===`);
398
- console.log('Review this cap carefully before trusting it.');
415
+ if (isRequestCap) {
416
+ console.log('This is a request cap — review the need, then vouch to signal demand.');
417
+ } else {
418
+ console.log('Review this cap carefully before trusting it.');
419
+ }
399
420
  console.log('');
400
421
  console.log(` Ref: ${ref}`);
422
+ if (record.kind) console.log(` Kind: ${record.kind}`);
401
423
  if (title) console.log(` Title: ${title}`);
402
424
  console.log(` Author: ${author}`);
403
425
  if (description) {
@@ -411,9 +433,15 @@ export default function register(program) {
411
433
  console.log('---');
412
434
  }
413
435
  console.log('');
414
- console.log('To trust this cap, run:');
415
- console.log('');
416
- console.log(` vit vet ${ref} --trust`);
436
+ if (isRequestCap) {
437
+ console.log('This is a request cap — review the need, then:');
438
+ console.log('');
439
+ console.log(` vit vouch ${ref} --kind want`);
440
+ } else {
441
+ console.log('To trust this cap, run:');
442
+ console.log('');
443
+ console.log(` vit vet ${ref} --trust`);
444
+ }
417
445
  } else {
418
446
  // Skill vet — no beacon required
419
447
  const skillName = nameFromSkillRef(ref);
@@ -448,6 +476,10 @@ export default function register(program) {
448
476
  return;
449
477
  }
450
478
  console.error(`no skill found with ref '${ref}' from followed accounts.`);
479
+ console.error('');
480
+ console.error('hint: skills appear from accounts you follow and your own.');
481
+ console.error(` vit following check who you're following`);
482
+ console.error(` vit explore skills browse skills network-wide`);
451
483
  process.exitCode = 1;
452
484
  return;
453
485
  }
package/src/cmd/vouch.js CHANGED
@@ -17,8 +17,9 @@ export default function register(program) {
17
17
  program
18
18
  .command('vouch')
19
19
  .argument('<ref>', 'Cap or skill reference (e.g. fast-cache-invalidation or skill-agent-test-patterns)')
20
- .description('Publicly endorse a vetted cap or skill')
20
+ .description('Publicly endorse a vetted cap or skill, or signal demand with --kind want')
21
21
  .option('--did <did>', 'DID to use')
22
+ .option('--kind <kind>', 'Vouch intent: endorse (default, quality signal) or want (demand signal)')
22
23
  .option('--json', 'Output as JSON')
23
24
  .option('-v, --verbose', 'Show step-by-step details')
24
25
  .action(async (ref, opts) => {
@@ -27,6 +28,20 @@ export default function register(program) {
27
28
  const vlog = opts.json ? (...a) => console.error(...a) : console.log;
28
29
  const isSkill = isSkillRef(ref);
29
30
 
31
+ // Validate --kind if provided
32
+ if (opts.kind) {
33
+ const validVouchKinds = ['endorse', 'want'];
34
+ if (!validVouchKinds.includes(opts.kind)) {
35
+ if (opts.json) {
36
+ jsonError(`--kind must be one of: ${validVouchKinds.join(', ')}`);
37
+ return;
38
+ }
39
+ console.error(`error: --kind must be one of: ${validVouchKinds.join(', ')}`);
40
+ process.exitCode = 1;
41
+ return;
42
+ }
43
+ }
44
+
30
45
  // Validate ref format
31
46
  if (isSkill) {
32
47
  if (!isValidSkillRef(ref)) {
@@ -111,6 +126,10 @@ export default function register(program) {
111
126
  return;
112
127
  }
113
128
  console.error(`no skill found with ref '${ref}' from followed accounts.`);
129
+ console.error('');
130
+ console.error('hint: skills appear from accounts you follow and your own.');
131
+ console.error(` vit following check who you're following`);
132
+ console.error(` vit explore skills browse skills network-wide`);
114
133
  process.exitCode = 1;
115
134
  return;
116
135
  }
@@ -155,37 +174,43 @@ export default function register(program) {
155
174
  }
156
175
  console.log(`${mark} vouched: ${ref} (${match.uri})`);
157
176
  } else {
158
- // Cap vouch — requires beacon (check beacon before trusted, matching original behavior)
177
+ const vouchKind = opts.kind || 'endorse';
178
+ const isWant = vouchKind === 'want';
179
+
180
+ // Cap vouch — beacon required unless want-vouching (demand signal)
159
181
  const beaconSet = readBeaconSet();
160
- if (beaconSet.size === 0) {
161
- if (opts.json) {
162
- jsonError('no beacon set', "run 'vit init' first");
182
+
183
+ if (!isWant) {
184
+ if (beaconSet.size === 0) {
185
+ if (opts.json) {
186
+ jsonError('no beacon set', "run 'vit init' first");
187
+ return;
188
+ }
189
+ console.error(`no beacon set. run '${name} init' in a project directory first.`);
190
+ process.exitCode = 1;
163
191
  return;
164
192
  }
165
- console.error(`no beacon set. run '${name} init' in a project directory first.`);
166
- process.exitCode = 1;
167
- return;
168
- }
169
- if (verbose) vlog(`[verbose] beacons: ${[...beaconSet].join(', ')}`);
193
+ if (verbose) vlog(`[verbose] beacons: ${[...beaconSet].join(', ')}`);
170
194
 
171
- const trusted = readLog('trusted.jsonl');
172
- const trustedEntry = trusted.find(e => e.ref === ref);
173
- if (!trustedEntry) {
174
- if (opts.json) {
175
- jsonError(`cap '${ref}' is not yet vetted`, `run 'vit vet ${ref}' first`);
195
+ const trusted = readLog('trusted.jsonl');
196
+ const trustedEntry = trusted.find(e => e.ref === ref);
197
+ if (!trustedEntry) {
198
+ if (opts.json) {
199
+ jsonError(`cap '${ref}' is not yet vetted`, `run 'vit vet ${ref}' first`);
200
+ return;
201
+ }
202
+ console.error(`cap '${ref}' is not yet vetted. vet it first:`);
203
+ console.error('');
204
+ console.error(` vit vet ${ref}`);
205
+ console.error('');
206
+ console.error('after reviewing, trust it with:');
207
+ console.error('');
208
+ console.error(` vit vet ${ref} --trust`);
209
+ process.exitCode = 1;
176
210
  return;
177
211
  }
178
- console.error(`cap '${ref}' is not yet vetted. vet it first:`);
179
- console.error('');
180
- console.error(` vit vet ${ref}`);
181
- console.error('');
182
- console.error('after reviewing, trust it with:');
183
- console.error('');
184
- console.error(` vit vet ${ref} --trust`);
185
- process.exitCode = 1;
186
- return;
212
+ if (verbose) vlog(`[verbose] trusted entry found, uri: ${trustedEntry.uri}`);
187
213
  }
188
- if (verbose) vlog(`[verbose] trusted entry found, uri: ${trustedEntry.uri}`);
189
214
 
190
215
  const { agent } = await restoreAgent(did);
191
216
  if (verbose) vlog('[verbose] session restored');
@@ -203,7 +228,7 @@ export default function register(program) {
203
228
  let match = null;
204
229
  for (const records of allRecords) {
205
230
  for (const rec of records) {
206
- if (!beaconSet.has(rec.value.beacon)) continue;
231
+ if (!isWant && !beaconSet.has(rec.value.beacon)) continue;
207
232
  const recRef = resolveRef(rec.value, rec.cid);
208
233
  if (recRef === ref) {
209
234
  if (!match || (rec.value.createdAt || '') > (match.value.createdAt || '')) {
@@ -215,15 +240,20 @@ export default function register(program) {
215
240
 
216
241
  if (!match) {
217
242
  if (opts.json) {
218
- jsonError(`no cap found with ref '${ref}' for this beacon`);
243
+ jsonError(`no cap found with ref '${ref}'${!isWant ? ' for this beacon' : ''}`);
219
244
  return;
220
245
  }
221
- console.error(`no cap found with ref '${ref}' for this beacon.`);
246
+ console.error(`no cap found with ref '${ref}'${!isWant ? ' for this beacon' : ''}.`);
247
+ console.error('');
248
+ console.error('hint: caps only appear from accounts you follow and your own.');
249
+ console.error(` vit following check who you're following`);
250
+ console.error(` vit explore cap ${ref} search the network-wide index`);
222
251
  process.exitCode = 1;
223
252
  return;
224
253
  }
225
254
 
226
255
  const now = new Date().toISOString();
256
+ const projBeacon = beaconSet.size > 0 ? [...beaconSet][0] : (match.value.beacon || null);
227
257
  const vouchRecord = {
228
258
  $type: VOUCH_COLLECTION,
229
259
  subject: {
@@ -232,16 +262,17 @@ export default function register(program) {
232
262
  },
233
263
  createdAt: now,
234
264
  ref,
235
- beacon,
265
+ kind: vouchKind,
236
266
  };
237
- if (verbose) vlog(`[verbose] creating vouch for ${match.uri}`);
267
+ if (projBeacon) vouchRecord.beacon = projBeacon;
268
+ if (verbose) vlog(`[verbose] creating vouch (${vouchKind}) for ${match.uri}`);
238
269
  const rkey = TID.nextStr();
239
270
  const res = await agent.com.atproto.repo.putRecord({
240
271
  repo: did,
241
272
  collection: VOUCH_COLLECTION,
242
273
  rkey,
243
274
  record: vouchRecord,
244
- validate: true,
275
+ validate: false,
245
276
  });
246
277
 
247
278
  try {
@@ -250,7 +281,8 @@ export default function register(program) {
250
281
  uri: match.uri,
251
282
  cid: match.cid,
252
283
  vouchUri: res.data.uri,
253
- beacon,
284
+ kind: vouchKind,
285
+ beacon: projBeacon,
254
286
  ts: now,
255
287
  });
256
288
  } catch (logErr) {
@@ -259,10 +291,15 @@ export default function register(program) {
259
291
  if (verbose) vlog('[verbose] logged to vouched.jsonl');
260
292
 
261
293
  if (opts.json) {
262
- jsonOk({ ref, uri: match.uri, vouchUri: res.data.uri });
294
+ jsonOk({ ref, uri: match.uri, vouchUri: res.data.uri, kind: vouchKind });
263
295
  return;
264
296
  }
265
- console.log(`${mark} vouched: ${ref} (${match.uri})`);
297
+ if (isWant) {
298
+ console.log(`${mark} vouched (want): ${ref}`);
299
+ console.log(` demand signal recorded. vouch count visible in vit explore vouches.`);
300
+ } else {
301
+ console.log(`${mark} vouched: ${ref} (${match.uri})`);
302
+ }
266
303
  }
267
304
  } catch (err) {
268
305
  const msg = err instanceof Error ? err.message : String(err);
@@ -0,0 +1,26 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright (c) 2026 sol pbc
3
+
4
+ import { spawnSync } from 'node:child_process';
5
+ import { dirname, join } from 'node:path';
6
+ import { fileURLToPath } from 'node:url';
7
+
8
+ 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
+ }
24
+ } catch {
25
+ process.exit(0);
26
+ }
package/src/cmd/setup.js DELETED
@@ -1,76 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- // Copyright (c) 2026 sol pbc
3
-
4
- import { spawnSync } from 'node:child_process';
5
- import { loadConfig, saveConfig } from '../lib/config.js';
6
- import { requireNotAgent } from '../lib/agent.js';
7
- import { which } from '../lib/compat.js';
8
- import { mark, brand, name } from '../lib/brand.js';
9
-
10
- export default function register(program) {
11
- program
12
- .command('setup')
13
- .description('Initialize user-level vit setup')
14
- .action(async () => {
15
- try {
16
- const gate = requireNotAgent();
17
- if (!gate.ok) {
18
- console.error(`${name} setup must be run by a human. run it in your own terminal.`);
19
- process.exitCode = 1;
20
- return;
21
- }
22
-
23
- const gitPath = which('git');
24
- console.log(`${mark} git: ${gitPath ? 'found' : 'not found'}`);
25
- if (!gitPath) {
26
- console.error('missing required tool: git');
27
- process.exitCode = 1;
28
- return;
29
- }
30
-
31
- // skill installation
32
- const npxPath = which('npx');
33
- if (npxPath) {
34
- try {
35
- const result = spawnSync(
36
- 'npx', ['skills', 'add', 'https://github.com/solpbc/vit/tree/main/skills/vit', '-a', 'claude-code', '-y'],
37
- {
38
- encoding: 'utf-8',
39
- stdio: ['pipe', 'pipe', 'pipe'],
40
- }
41
- );
42
- if (result.status === 0) {
43
- console.log(`${mark} skill: installed (using-vit)`);
44
- } else {
45
- const errText = (result.stderr || '').trim();
46
- console.log(`${mark} skill: failed (${errText || 'unknown error'})`);
47
- }
48
- } catch {
49
- console.log(`${mark} skill: failed (could not run npx skills)`);
50
- }
51
- } else {
52
- console.log(`${mark} skill: skipped (npx not found)`);
53
- }
54
-
55
- const config = loadConfig();
56
- if (config.did) {
57
- console.log(`${mark} login: ${config.did}`);
58
- } else {
59
- console.log(`${mark} login: not logged in`);
60
- console.log(`next: run '${name} login <handle>' to authenticate with Bluesky`);
61
- }
62
-
63
- if (!config.setup_at) {
64
- config.setup_at = Math.floor(Date.now() / 1000);
65
- saveConfig(config);
66
- }
67
-
68
- if (config.did) {
69
- console.log(`${brand} setup complete`);
70
- }
71
- } catch (err) {
72
- console.error(err instanceof Error ? err.message : String(err));
73
- process.exitCode = 1;
74
- }
75
- });
76
- }