vit 0.1.3 → 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.
@@ -0,0 +1,131 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright (c) 2026 sol pbc
3
+
4
+ import { DEFAULT_EXPLORE_URL } from '../lib/constants.js';
5
+ import { readBeaconSet } from '../lib/vit-dir.js';
6
+ import { brand } from '../lib/brand.js';
7
+ import { jsonOk, jsonError } from '../lib/json-output.js';
8
+
9
+ function timeAgo(isoString) {
10
+ const seconds = Math.floor((Date.now() - new Date(isoString).getTime()) / 1000);
11
+ if (seconds < 60) return `${seconds}s ago`;
12
+ const minutes = Math.floor(seconds / 60);
13
+ if (minutes < 60) return `${minutes}m ago`;
14
+ const hours = Math.floor(minutes / 60);
15
+ if (hours < 24) return `${hours}h ago`;
16
+ const days = Math.floor(hours / 24);
17
+ return `${days}d ago`;
18
+ }
19
+
20
+ function resolveUrl(opts) {
21
+ return opts.exploreUrl || process.env.VIT_EXPLORE_URL || DEFAULT_EXPLORE_URL;
22
+ }
23
+
24
+ function unavailableMessage(baseUrl) {
25
+ try {
26
+ return `${new URL(baseUrl).host} is unavailable. try 'vit explore caps --beacon .' for network-wide discovery.`;
27
+ } catch {
28
+ return `${baseUrl} is unavailable. try 'vit explore caps --beacon .' for network-wide discovery.`;
29
+ }
30
+ }
31
+
32
+ export default function register(program) {
33
+ program
34
+ .command('inbox')
35
+ .description('Show caps addressed to your project beacon (project-centric view)')
36
+ .option('--kind <kind>', 'Filter by cap kind (e.g. request)')
37
+ .option('--sort <sort>', 'Sort order: recent (default) or want-vouches', 'recent')
38
+ .option('--limit <n>', 'Limit number of caps')
39
+ .option('--json', 'Output as JSON')
40
+ .option('--explore-url <url>', 'Explore API base URL')
41
+ .action(async (opts) => {
42
+ try {
43
+ const beaconSet = readBeaconSet();
44
+ if (beaconSet.size === 0) {
45
+ const msg = "no beacon set — run 'vit init' first (inbox requires a project beacon)";
46
+ if (opts.json) {
47
+ jsonError(msg);
48
+ return;
49
+ }
50
+ console.error(msg);
51
+ process.exitCode = 1;
52
+ return;
53
+ }
54
+
55
+ const beacon = [...beaconSet].join(',');
56
+ const baseUrl = resolveUrl(opts);
57
+
58
+ let data;
59
+ try {
60
+ const url = new URL('/api/caps', baseUrl);
61
+ url.searchParams.set('beacon', beacon);
62
+ if (opts.kind) url.searchParams.set('kind', opts.kind);
63
+ if (opts.sort === 'want-vouches') url.searchParams.set('sort', 'want-vouches');
64
+ if (opts.limit) url.searchParams.set('limit', opts.limit);
65
+
66
+ const res = await fetch(url);
67
+ if (!res.ok) throw new Error(`explore API returned ${res.status}`);
68
+ data = await res.json();
69
+ } catch (err) {
70
+ const msg = err instanceof Error ? err.message : String(err);
71
+ const finalMsg = msg.startsWith('explore API returned ')
72
+ ? msg
73
+ : unavailableMessage(baseUrl);
74
+ if (opts.json) {
75
+ jsonError(finalMsg);
76
+ return;
77
+ }
78
+ console.error(finalMsg);
79
+ console.error("fallback: try 'vit explore caps --beacon .' to query the explore index directly.");
80
+ process.exitCode = 1;
81
+ return;
82
+ }
83
+
84
+ if (opts.json) {
85
+ jsonOk({ caps: data.caps || [], cursor: data.cursor || null });
86
+ return;
87
+ }
88
+
89
+ const caps = data.caps || [];
90
+ const beaconDisplay = [...beaconSet][0];
91
+
92
+ console.log(`${brand} inbox — ${beaconDisplay}`);
93
+ console.log('');
94
+
95
+ if (caps.length === 0) {
96
+ const kindFilter = opts.kind ? ` (kind: ${opts.kind})` : '';
97
+ console.log(`no caps found${kindFilter}.`);
98
+ if (opts.kind) {
99
+ console.log(`hint: to request a feature, run 'vit ship --kind request --beacon <url>'`);
100
+ }
101
+ return;
102
+ }
103
+
104
+ for (const cap of caps) {
105
+ const wantCount = cap.want_vouch_count ?? 0;
106
+ const wantStr = wantCount === 1 ? '1 want' : `${wantCount} wants`;
107
+ const age = cap.created_at ? timeAgo(cap.created_at) : '';
108
+ const handle = cap.handle ? `@${cap.handle}` : cap.did || 'unknown';
109
+ const kind = cap.kind || (cap.record_json ? (() => { try { return JSON.parse(cap.record_json).kind || ''; } catch { return ''; } })() : '');
110
+
111
+ console.log(` ${cap.ref} ${handle} ${wantStr} ${age}`);
112
+ if (cap.title) console.log(` ${cap.title}${kind ? ` [${kind}]` : ''}`);
113
+ if (cap.description) console.log(` ${cap.description}`);
114
+ console.log('');
115
+ }
116
+
117
+ const kindNote = opts.kind ? ` ${opts.kind}` : '';
118
+ console.log(`${caps.length} open${kindNote} cap${caps.length === 1 ? '' : 's'}`);
119
+ console.log(`tip: 'vit vouch <ref> --kind want' to signal demand`);
120
+ console.log(` 'vit ship --recap <ref>' to ship an implementation`);
121
+ } catch (err) {
122
+ const msg = err instanceof Error ? err.message : String(err);
123
+ if (opts.json) {
124
+ jsonError(msg);
125
+ return;
126
+ }
127
+ console.error(msg);
128
+ process.exitCode = 1;
129
+ }
130
+ });
131
+ }
package/src/cmd/learn.js CHANGED
@@ -1,9 +1,10 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  // Copyright (c) 2026 sol pbc
3
3
 
4
- import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
4
+ import { spawnSync } from 'node:child_process';
5
+ import { mkdirSync, writeFileSync, mkdtempSync, rmSync } from 'node:fs';
5
6
  import { join, dirname } from 'node:path';
6
- import { homedir } from 'node:os';
7
+ import { homedir, tmpdir } from 'node:os';
7
8
  import { requireDid } from '../lib/config.js';
8
9
  import { SKILL_COLLECTION } from '../lib/constants.js';
9
10
  import { restoreAgent } from '../lib/oauth.js';
@@ -78,7 +79,7 @@ export default function register(program) {
78
79
  return;
79
80
  }
80
81
  console.error(`skill '${ref}' is not yet vetted. user-wide install requires vetting.`);
81
- console.error(`ask the user to vet it first:`);
82
+ console.error(`tell your operator to vet it first:`);
82
83
  console.error('');
83
84
  console.error(` vit vet ${ref}`);
84
85
  console.error('');
@@ -98,7 +99,7 @@ export default function register(program) {
98
99
  return;
99
100
  }
100
101
  console.error(`skill '${ref}' is not yet vetted.`);
101
- console.error(`ask the user to vet it first:`);
102
+ console.error(`tell your operator to vet it first:`);
102
103
  console.error('');
103
104
  console.error(` vit vet ${ref}`);
104
105
  console.error('');
@@ -158,6 +159,10 @@ export default function register(program) {
158
159
  return;
159
160
  }
160
161
  console.error(`no skill found with ref '${ref}' from followed accounts.`);
162
+ console.error('');
163
+ console.error('hint: skills appear from accounts you follow and your own.');
164
+ console.error(` vit following check who you're following`);
165
+ console.error(` vit explore skills browse skills network-wide`);
161
166
  process.exitCode = 1;
162
167
  return;
163
168
  }
@@ -165,48 +170,61 @@ export default function register(program) {
165
170
  const record = match.value;
166
171
  if (verbose) vlog(`[verbose] found skill: ${record.name} from ${match.uri}`);
167
172
 
168
- // Determine install path
169
- let installDir;
170
- if (isUserInstall) {
171
- installDir = join(homedir(), '.claude', 'skills', skillName);
172
- } else {
173
- installDir = join(process.cwd(), '.claude', 'skills', skillName);
174
- }
173
+ // Install via skills CLI
174
+ const tempDir = mkdtempSync(join(tmpdir(), 'vit-learn-'));
175
+ try {
176
+ writeFileSync(join(tempDir, 'SKILL.md'), record.text);
177
+ if (verbose) vlog('[verbose] wrote SKILL.md to temp dir');
178
+
179
+ // Download resource blobs to temp dir
180
+ if (record.resources && record.resources.length > 0) {
181
+ const authorDid = match.uri.split('/')[2];
182
+ const pds = await resolvePds(authorDid);
183
+
184
+ for (const resource of record.resources) {
185
+ const resourcePath = join(tempDir, resource.path);
186
+ mkdirSync(dirname(resourcePath), { recursive: true });
175
187
 
176
- mkdirSync(installDir, { recursive: true });
177
-
178
- // Write SKILL.md from text field — verbatim, no reconstruction
179
- writeFileSync(join(installDir, 'SKILL.md'), record.text);
180
- if (verbose) vlog(`[verbose] wrote SKILL.md to ${installDir}`);
181
-
182
- // Download and write resource blobs
183
- if (record.resources && record.resources.length > 0) {
184
- const authorDid = match.uri.split('/')[2];
185
- const pds = await resolvePds(authorDid);
186
-
187
- for (const resource of record.resources) {
188
- const resourcePath = join(installDir, resource.path);
189
- mkdirSync(dirname(resourcePath), { recursive: true });
190
-
191
- try {
192
- // Download blob from PDS
193
- const blobCid = resource.blob?.ref?.$link || resource.blob?.cid;
194
- if (blobCid) {
195
- const blobUrl = new URL('/xrpc/com.atproto.sync.getBlob', pds);
196
- blobUrl.searchParams.set('did', authorDid);
197
- blobUrl.searchParams.set('cid', blobCid);
198
- const blobRes = await fetch(blobUrl);
199
- if (!blobRes.ok) throw new Error(`blob fetch failed: ${blobRes.status}`);
200
- const blobData = Buffer.from(await blobRes.arrayBuffer());
201
- writeFileSync(resourcePath, blobData);
202
- if (verbose) vlog(`[verbose] wrote resource: ${resource.path}`);
188
+ try {
189
+ // Download blob from PDS
190
+ const blobCid = resource.blob?.ref?.$link || resource.blob?.cid;
191
+ if (blobCid) {
192
+ const blobUrl = new URL('/xrpc/com.atproto.sync.getBlob', pds);
193
+ blobUrl.searchParams.set('did', authorDid);
194
+ blobUrl.searchParams.set('cid', blobCid);
195
+ const blobRes = await fetch(blobUrl);
196
+ if (!blobRes.ok) throw new Error(`blob fetch failed: ${blobRes.status}`);
197
+ const blobData = Buffer.from(await blobRes.arrayBuffer());
198
+ writeFileSync(resourcePath, blobData);
199
+ if (verbose) vlog(`[verbose] wrote resource: ${resource.path}`);
200
+ }
201
+ } catch (err) {
202
+ console.error(`warning: failed to download resource ${resource.path}: ${err.message}`);
203
203
  }
204
- } catch (err) {
205
- console.error(`warning: failed to download resource ${resource.path}: ${err.message}`);
206
204
  }
207
205
  }
206
+
207
+ // Delegate to skills CLI
208
+ const addArgs = ['skills', 'add', tempDir, '-a', 'claude-code', '-y'];
209
+ if (isUserInstall) addArgs.push('-g');
210
+ const addResult = spawnSync('npx', addArgs, {
211
+ encoding: 'utf-8',
212
+ stdio: ['pipe', 'pipe', 'pipe'],
213
+ });
214
+ if (addResult.status !== 0) {
215
+ const errText = (addResult.stderr || addResult.stdout || '').trim();
216
+ throw new Error(`skill install failed: ${errText || 'unknown error'}`);
217
+ }
218
+ if (verbose) vlog('[verbose] installed via npx skills add');
219
+ } finally {
220
+ try { rmSync(tempDir, { recursive: true, force: true }); } catch {}
208
221
  }
209
222
 
223
+ // Determine install path for logging
224
+ const installDir = isUserInstall
225
+ ? join(homedir(), '.claude', 'skills', skillName)
226
+ : join(process.cwd(), '.claude', 'skills', skillName);
227
+
210
228
  // Log to learned.jsonl
211
229
  try {
212
230
  appendLog('learned.jsonl', {
package/src/cmd/remix.js CHANGED
@@ -74,10 +74,10 @@ export default function register(program) {
74
74
  const trustGate = shouldBypassVet();
75
75
  if (!trustGate.bypass) {
76
76
  if (opts.json) {
77
- jsonError(`cap '${ref}' is not trusted`, `ask user to run 'vit vet ${ref} --trust'`);
77
+ jsonError(`cap '${ref}' is not trusted`, `tell your operator to run 'vit vet ${ref} --trust'`);
78
78
  return;
79
79
  }
80
- console.error(`cap '${ref}' is not trusted. ask the user to vet it first:`);
80
+ console.error(`cap '${ref}' is not trusted. tell your operator to vet it first:`);
81
81
  console.error('');
82
82
  console.error(` vit vet ${ref}`);
83
83
  console.error('');
@@ -129,6 +129,10 @@ export default function register(program) {
129
129
  return;
130
130
  }
131
131
  console.error(`no cap found with ref '${ref}' for this beacon.`);
132
+ console.error('');
133
+ console.error('hint: caps only appear from accounts you follow and your own.');
134
+ console.error(` vit following check who you're following`);
135
+ console.error(` vit explore cap ${ref} search the network-wide index`);
132
136
  process.exitCode = 1;
133
137
  return;
134
138
  }
package/src/cmd/scan.js CHANGED
@@ -162,6 +162,8 @@ export default function register(program) {
162
162
  return;
163
163
  }
164
164
  console.log(`no ${scanType} publishers found in this time window.`);
165
+ console.log('the network is young — be an early publisher.');
166
+ console.log("ship a cap with 'vit ship' or a skill with 'vit ship --skill' to get things started.");
165
167
  return;
166
168
  }
167
169
 
package/src/cmd/ship.js CHANGED
@@ -14,6 +14,43 @@ import { isValidSkillName, skillRefFromName } from '../lib/skill-ref.js';
14
14
  import { name } from '../lib/brand.js';
15
15
  import { resolvePds, listRecordsFromPds, batchQuery } from '../lib/pds.js';
16
16
  import { jsonOk, jsonError } from '../lib/json-output.js';
17
+ import { toBeacon } from '../lib/beacon.js';
18
+ import { hashTo3Words } from '../lib/cap-ref.js';
19
+
20
+ const STOP_WORDS = new Set([
21
+ 'a', 'an', 'the', 'and', 'or', 'but', 'in', 'on', 'at', 'to', 'for',
22
+ 'of', 'with', 'by', 'from', 'is', 'was', 'be', 'has', 'have', 'had',
23
+ 'this', 'that', 'these', 'those', 'it', 'its', 'not', 'no', 'as', 'if', 'so',
24
+ ]);
25
+
26
+ function slugifyTitle(title) {
27
+ const words = title.toLowerCase()
28
+ .replace(/[^a-z\s]/g, '')
29
+ .split(/\s+/)
30
+ .filter(Boolean);
31
+ const significant = words.filter(w => !STOP_WORDS.has(w));
32
+ const chosen = significant.length >= 3 ? significant.slice(0, 3) : words.slice(0, 3);
33
+ return chosen.join('-');
34
+ }
35
+
36
+ function generateRef(title, existingRefs) {
37
+ const base = slugifyTitle(title);
38
+ if (base && base.split('-').length >= 3 && !existingRefs.has(base)) {
39
+ return base;
40
+ }
41
+ // Fall back to hash-based 3-word ref (always valid, collision-resistant)
42
+ const hashed = hashTo3Words(title);
43
+ if (!existingRefs.has(hashed)) return hashed;
44
+ // Hash of title + timestamp to break hash collision
45
+ const hashed2 = hashTo3Words(title + Date.now());
46
+ if (!existingRefs.has(hashed2)) return hashed2;
47
+ return null;
48
+ }
49
+
50
+ function normalizeBeacon(input) {
51
+ if (input.startsWith('vit:')) return input;
52
+ return 'vit:' + toBeacon(input);
53
+ }
17
54
 
18
55
  function parseFrontmatter(text) {
19
56
  const match = text.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/);
@@ -200,7 +237,7 @@ async function shipSkill(opts) {
200
237
  jsonError('session expired or invalid', "run 'vit login <handle>'");
201
238
  return;
202
239
  }
203
- console.error(`session expired or invalid. tell your user to run '${name} login <handle>'.`);
240
+ console.error(`session expired or invalid. tell your operator to run '${name} login <handle>'.`);
204
241
  process.exitCode = 1;
205
242
  return;
206
243
  }
@@ -335,16 +372,47 @@ async function shipCap(opts) {
335
372
 
336
373
  // preflight: beacon
337
374
  const projectConfig = readProjectConfig();
338
- if (!projectConfig.beacon) {
339
- if (opts.json) {
340
- jsonError('no beacon set', "run 'vit init' first");
375
+ const isRequest = opts.kind === 'request';
376
+
377
+ let beacon;
378
+ if (isRequest) {
379
+ // Request caps: --beacon flag or project config (in that order)
380
+ if (opts.beacon) {
381
+ try {
382
+ beacon = normalizeBeacon(opts.beacon);
383
+ } catch (err) {
384
+ if (opts.json) {
385
+ jsonError(`invalid --beacon: ${err.message}`);
386
+ return;
387
+ }
388
+ console.error(`error: invalid --beacon: ${err.message}`);
389
+ process.exitCode = 1;
390
+ return;
391
+ }
392
+ } else if (projectConfig.beacon) {
393
+ beacon = projectConfig.beacon;
394
+ } else {
395
+ if (opts.json) {
396
+ jsonError('request caps must be addressed to a project', 'use --beacon <github-url> or run from a vit-initialized directory');
397
+ return;
398
+ }
399
+ console.error('error: request caps must be addressed to a project. use --beacon <github-url> or run from a vit-initialized directory.');
400
+ process.exitCode = 1;
341
401
  return;
342
402
  }
343
- console.error(`no beacon set. run '${name} init' in a project directory first.`);
344
- process.exitCode = 1;
345
- return;
403
+ } else {
404
+ if (!projectConfig.beacon) {
405
+ if (opts.json) {
406
+ jsonError('no beacon set', "run 'vit init' first");
407
+ return;
408
+ }
409
+ console.error(`no beacon set. run '${name} init' in a project directory first.`);
410
+ process.exitCode = 1;
411
+ return;
412
+ }
413
+ beacon = projectConfig.beacon;
346
414
  }
347
- if (verbose) vlog(`[verbose] beacon: ${projectConfig.beacon}`);
415
+ if (verbose) vlog(`[verbose] beacon: ${beacon}`);
348
416
 
349
417
  let text;
350
418
  try {
@@ -352,7 +420,7 @@ async function shipCap(opts) {
352
420
  } catch {
353
421
  text = '';
354
422
  }
355
- if (!text) {
423
+ if (!text && !isRequest) {
356
424
  if (opts.json) {
357
425
  jsonError('cap body is required via stdin');
358
426
  return;
@@ -362,7 +430,27 @@ async function shipCap(opts) {
362
430
  return;
363
431
  }
364
432
 
365
- if (!REF_PATTERN.test(opts.ref)) {
433
+ // ref: required for non-request caps; auto-generated for request caps
434
+ let ref = opts.ref;
435
+ if (!ref && isRequest) {
436
+ const caps = readLog('caps.jsonl');
437
+ const existingRefs = new Set(caps.map(e => e.ref));
438
+ ref = generateRef(opts.title || '', existingRefs);
439
+ if (!ref) {
440
+ if (opts.json) {
441
+ jsonError('could not auto-generate ref from title', 'provide --ref explicitly');
442
+ return;
443
+ }
444
+ console.error('error: could not auto-generate a 3-word ref from the title. provide --ref explicitly.');
445
+ process.exitCode = 1;
446
+ return;
447
+ }
448
+ if (verbose || !opts.json) {
449
+ vlog(`ref: ${ref}`);
450
+ }
451
+ }
452
+
453
+ if (!REF_PATTERN.test(ref)) {
366
454
  if (opts.json) {
367
455
  jsonError('--ref must be exactly three lowercase words separated by dashes');
368
456
  return;
@@ -393,7 +481,7 @@ async function shipCap(opts) {
393
481
  }
394
482
 
395
483
  if (opts.kind) {
396
- const validKinds = ['feat', 'fix', 'test', 'docs', 'refactor', 'chore', 'perf', 'style'];
484
+ const validKinds = ['feat', 'fix', 'test', 'docs', 'refactor', 'chore', 'perf', 'style', 'request'];
397
485
  if (!validKinds.includes(opts.kind)) {
398
486
  if (opts.json) {
399
487
  jsonError(`--kind must be one of: ${validKinds.join(', ')}`);
@@ -416,7 +504,7 @@ async function shipCap(opts) {
416
504
  jsonError('session expired or invalid', "run 'vit login <handle>'");
417
505
  return;
418
506
  }
419
- console.error(`session expired or invalid. tell your user to run '${name} login <handle>'.`);
507
+ console.error(`session expired or invalid. tell your operator to run '${name} login <handle>'.`);
420
508
  process.exitCode = 1;
421
509
  return;
422
510
  }
@@ -461,13 +549,13 @@ async function shipCap(opts) {
461
549
 
462
550
  const record = {
463
551
  $type: CAP_COLLECTION,
464
- text,
552
+ text: text || '',
465
553
  title: opts.title,
466
554
  description: opts.description,
467
- ref: opts.ref,
555
+ ref,
468
556
  createdAt: now,
469
557
  };
470
- if (projectConfig.beacon) record.beacon = projectConfig.beacon;
558
+ if (beacon) record.beacon = beacon;
471
559
  if (opts.kind) record.kind = opts.kind;
472
560
  if (opts.recap) record.recap = { uri: recapUri, ref: opts.recap };
473
561
  const rkey = TID.nextStr();
@@ -486,7 +574,7 @@ async function shipCap(opts) {
486
574
  ts: now,
487
575
  did,
488
576
  rkey,
489
- ref: opts.ref,
577
+ ref,
490
578
  collection: CAP_COLLECTION,
491
579
  pds: session.serverMetadata?.issuer,
492
580
  uri: putRes.data.uri,
@@ -497,11 +585,19 @@ async function shipCap(opts) {
497
585
  }
498
586
  if (verbose) vlog(`[verbose] Log written to caps.jsonl`);
499
587
  if (opts.json) {
500
- jsonOk({ ref: opts.ref, uri: putRes.data.uri });
588
+ const out = { ref, uri: putRes.data.uri };
589
+ if (opts.kind) out.kind = opts.kind;
590
+ jsonOk(out);
501
591
  return;
502
592
  }
503
- console.log(`shipped: ${opts.ref}`);
504
- console.log(`uri: ${putRes.data.uri}`);
593
+ if (isRequest) {
594
+ console.log(`shipped: ${ref} (kind: request)`);
595
+ console.log(`beacon: ${beacon}`);
596
+ console.log(`anyone can implement this. share the ref to build demand.`);
597
+ } else {
598
+ console.log(`shipped: ${ref}`);
599
+ console.log(`uri: ${putRes.data.uri}`);
600
+ }
505
601
  if (verbose) {
506
602
  vlog(
507
603
  JSON.stringify({
@@ -524,9 +620,10 @@ export default function register(program) {
524
620
  .option('--did <did>', 'DID to use (reads saved DID from config if not provided)')
525
621
  .option('--title <title>', 'Short title for the cap')
526
622
  .option('--description <description>', 'Description of the cap')
527
- .option('--ref <ref>', 'Three lowercase words with dashes (e.g. fast-cache-invalidation)')
623
+ .option('--ref <ref>', 'Three lowercase words with dashes (e.g. fast-cache-invalidation); auto-generated from title when --kind request')
624
+ .option('--beacon <beacon>', 'Beacon URI or GitHub URL for the cap (required when --kind request outside a vit-initialized dir)')
528
625
  .option('--recap <ref>', 'Ref of the cap this derives from (quote-post semantics)')
529
- .option('--kind <kind>', 'Category: feat, fix, test, docs, refactor, chore, perf, style')
626
+ .option('--kind <kind>', 'Category: feat, fix, test, docs, refactor, chore, perf, style, request')
530
627
  .option('--skill <path>', 'Publish a skill directory (reads SKILL.md + resources)')
531
628
  .option('--tags <tags>', 'Comma-separated discovery tags (for skills)')
532
629
  .option('--version <version>', 'Version string (for skills, overrides frontmatter)')
@@ -555,7 +652,7 @@ export default function register(program) {
555
652
  process.exitCode = 1;
556
653
  return;
557
654
  }
558
- if (!opts.ref) {
655
+ if (!opts.ref && opts.kind !== 'request') {
559
656
  if (opts.json) {
560
657
  jsonError("required option '--ref <ref>' not specified");
561
658
  return;
@@ -586,8 +683,12 @@ Authoring guidance (for coding agents):
586
683
  --description One sentence explaining what this cap does
587
684
  --ref Three lowercase words with dashes (your-ref-name)
588
685
  --recap <ref> Optional. Ref of the cap this derives from (links back to original)
589
- --kind <kind> Category: feat, fix, test, docs, refactor, chore, perf, style
590
- body (stdin) Full cap content, piped or via heredoc
686
+ --kind <kind> Category: feat, fix, test, docs, refactor, chore, perf, style, request
687
+ body (stdin) Full cap content, piped or via heredoc (optional when --kind request)
688
+
689
+ Request caps (--kind request):
690
+ --beacon <url> GitHub URL or vit: URI for the project being requested (auto-read from .vit if omitted)
691
+ --ref Optional; auto-generated from title if not provided
591
692
 
592
693
  Skill fields:
593
694
  --skill <path> Path to skill directory containing SKILL.md
package/src/cmd/skim.js CHANGED
@@ -21,6 +21,7 @@ export default function register(program) {
21
21
  .option('--json', 'Output as JSON array')
22
22
  .option('--caps', 'Show only caps')
23
23
  .option('--skills', 'Show only skills')
24
+ .option('--kind <kind>', 'Filter caps by kind (e.g. request, feat, fix)')
24
25
  .option('-v, --verbose', 'Show step-by-step details')
25
26
  .action(async (opts) => {
26
27
  try {
@@ -92,7 +93,10 @@ export default function register(program) {
92
93
  // Fetch caps (filtered by beacon)
93
94
  if (wantCaps && beaconSet.size > 0) {
94
95
  const res = await listRecordsFromPds(pds, repoDid, CAP_COLLECTION, 50);
95
- const caps = res.records.filter(r => beaconSet.has(r.value.beacon));
96
+ let caps = res.records.filter(r => beaconSet.has(r.value.beacon));
97
+ if (opts.kind) {
98
+ caps = caps.filter(r => r.value.kind === opts.kind);
99
+ }
96
100
  if (verbose) console.log(`[verbose] ${repoDid}: ${res.records.length} caps, ${caps.length} matching beacon`);
97
101
  for (const cap of caps) {
98
102
  cap._handle = handleMap.get(repoDid) || repoDid;
@@ -135,15 +139,41 @@ export default function register(program) {
135
139
  const capped = allItems.slice(0, limit);
136
140
 
137
141
  if (opts.json) {
138
- console.log(JSON.stringify(capped, null, 2));
142
+ if (capped.length === 0) {
143
+ const following = readFollowing();
144
+ let hint;
145
+ if (skillsOnly) {
146
+ hint = "no skills found — try 'vit explore skills' or ship your own with 'vit ship --skill'";
147
+ } else if (following.length === 0) {
148
+ hint = "not following anyone — run 'vit follow <handle>'";
149
+ } else {
150
+ hint = "no matching caps — try 'vit explore caps' or 'vit ship'";
151
+ }
152
+ console.log(JSON.stringify({ ok: true, items: [], hint }, null, 2));
153
+ } else {
154
+ console.log(JSON.stringify(capped, null, 2));
155
+ }
139
156
  } else {
140
157
  if (capped.length === 0) {
141
158
  if (skillsOnly) {
142
- console.log('no skills found.');
143
- } else if (opts.caps) {
144
- console.log('no caps found for this beacon.');
159
+ console.log('no skills found from followed accounts.');
160
+ console.log('');
161
+ console.log("try 'vit explore skills' to discover skills network-wide, or ship your own with 'vit ship --skill'.");
145
162
  } else {
146
- console.log('no caps or skills found.');
163
+ const following = readFollowing();
164
+ if (following.length === 0) {
165
+ console.log("no caps or skills found. you're not following anyone yet and haven't shipped any caps for this beacon.");
166
+ console.log('');
167
+ console.log('next steps:');
168
+ console.log(' vit scan discover active publishers on the network');
169
+ console.log(' vit follow <handle> start following someone to see their caps');
170
+ console.log(' vit ship publish a cap to seed the network');
171
+ } else {
172
+ console.log('no caps found for this beacon from your followed accounts.');
173
+ console.log('');
174
+ console.log("the network grows when people ship. publish a cap with 'vit ship' to get things started for this project.");
175
+ console.log("try 'vit explore caps' for network-wide discovery.");
176
+ }
147
177
  }
148
178
  }
149
179
  for (const rec of capped) {
@@ -172,8 +202,10 @@ export default function register(program) {
172
202
  console.log();
173
203
  }
174
204
  }
175
- console.log('---');
176
- console.log(`hint: tell your user to run '${name} vet <ref>' in another terminal for any item they want to review.`);
205
+ if (capped.length > 0) {
206
+ console.log('---');
207
+ console.log(`hint: tell your operator to run '${name} vet <ref>' in another terminal for any item they want to review.`);
208
+ }
177
209
  }
178
210
  } catch (err) {
179
211
  console.error(err instanceof Error ? err.message : String(err));