vit 0.5.0 → 0.6.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 CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "vit",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Social toolkit for personalized software",
5
5
  "license": "MIT",
6
6
  "bin": {
7
7
  "vit": "bin/vit.js"
8
8
  },
9
+ "exports": {
10
+ "./cap.js": "./src/lib/cap.js"
11
+ },
9
12
  "files": [
10
13
  "bin/",
11
14
  "src/",
@@ -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
 
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
@@ -247,7 +247,7 @@ Examples:
247
247
  jsonError('agent required', 'run vit learn from a coding agent');
248
248
  return;
249
249
  }
250
- 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).`);
251
251
  console.error(`open your agent and ask it to run '${name} learn' for you.`);
252
252
  process.exitCode = 1;
253
253
  return;
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
@@ -17,6 +17,7 @@ import { jsonOk, jsonError } from '../lib/json-output.js';
17
17
  import { toBeacon } from '../lib/beacon.js';
18
18
  import { hashTo3Words } from '../lib/cap-ref.js';
19
19
  import { formatError } from '../lib/error-format.js';
20
+ import { publishCap } from '../lib/cap.js';
20
21
 
21
22
  const STOP_WORDS = new Set([
22
23
  'a', 'an', 'the', 'and', 'or', 'but', 'in', 'on', 'at', 'to', 'for',
@@ -143,7 +144,7 @@ async function shipSkill(opts) {
143
144
  jsonError('agent required', 'run vit ship --skill from a coding agent');
144
145
  return;
145
146
  }
146
- console.error(`${name} ship --skill should be run by a coding agent (e.g. claude code, gemini cli).`);
147
+ console.error(`${name} ship --skill should be run by a coding agent (e.g. claude code, codex, gemini cli, opencode).`);
147
148
  console.error(`open your agent and ask it to run '${name} ship --skill' for you.`);
148
149
  process.exitCode = 1;
149
150
  return;
@@ -345,14 +346,14 @@ async function shipSkill(opts) {
345
346
  }
346
347
  }
347
348
 
348
- async function shipCap(opts) {
349
+ export async function shipCap(opts) {
349
350
  const gate = requireAgent();
350
351
  if (!gate.ok) {
351
352
  if (opts.json) {
352
353
  jsonError('agent required', 'run vit ship from a coding agent');
353
354
  return;
354
355
  }
355
- console.error(`${name} ship should be run by a coding agent (e.g. claude code, gemini cli).`);
356
+ console.error(`${name} ship should be run by a coding agent (e.g. claude code, codex, gemini cli, opencode).`);
356
357
  console.error(`open your agent and ask it to run '${name} ship' for you.`);
357
358
  console.error(`refer to the using-vit skill (skills/vit/SKILL.md) for a shipping guide.`);
358
359
  process.exitCode = 1;
@@ -548,28 +549,21 @@ async function shipCap(opts) {
548
549
  }
549
550
  }
550
551
 
551
- const record = {
552
- $type: CAP_COLLECTION,
553
- text: text || '',
552
+ const rkey = TID.nextStr();
553
+ if (verbose) vlog(`[verbose] Record built, rkey: ${rkey}`);
554
+ if (verbose) vlog(`[verbose] putRecord ${CAP_COLLECTION} rkey=${rkey}`);
555
+ const { uri, cid, record, response } = await publishCap(agent, {
556
+ repo: did,
557
+ text,
554
558
  title: opts.title,
555
559
  description: opts.description,
556
560
  ref,
557
561
  createdAt: now,
558
- };
559
- if (beacon) record.beacon = beacon;
560
- if (opts.kind) record.kind = opts.kind;
561
- if (opts.recap) record.recap = { uri: recapUri, ref: opts.recap };
562
- const rkey = TID.nextStr();
563
- if (verbose) vlog(`[verbose] Record built, rkey: ${rkey}`);
564
- const putArgs = {
565
- repo: did,
566
- collection: CAP_COLLECTION,
562
+ beacon,
563
+ kind: opts.kind,
564
+ recap: opts.recap ? { uri: recapUri, ref: opts.recap } : undefined,
567
565
  rkey,
568
- record,
569
- validate: false,
570
- };
571
- if (verbose) vlog(`[verbose] putRecord ${putArgs.collection} rkey=${rkey}`);
572
- const putRes = await agent.com.atproto.repo.putRecord(putArgs);
566
+ });
573
567
  try {
574
568
  appendLog('caps.jsonl', {
575
569
  ts: now,
@@ -578,15 +572,15 @@ async function shipCap(opts) {
578
572
  ref,
579
573
  collection: CAP_COLLECTION,
580
574
  pds: session.serverMetadata?.issuer,
581
- uri: putRes.data.uri,
582
- cid: putRes.data.cid,
575
+ uri,
576
+ cid,
583
577
  });
584
578
  } catch (logErr) {
585
579
  console.error('warning: failed to write caps.jsonl:', logErr.message);
586
580
  }
587
581
  if (verbose) vlog(`[verbose] Log written to caps.jsonl`);
588
582
  if (opts.json) {
589
- const out = { ref, uri: putRes.data.uri };
583
+ const out = { ref, uri };
590
584
  if (opts.kind) out.kind = opts.kind;
591
585
  jsonOk(out);
592
586
  return;
@@ -597,16 +591,17 @@ async function shipCap(opts) {
597
591
  console.log(`anyone can implement this. share the ref to build demand.`);
598
592
  } else {
599
593
  console.log(`shipped: ${ref}`);
600
- console.log(`uri: ${putRes.data.uri}`);
594
+ console.log(`uri: ${uri}`);
601
595
  }
602
596
  if (verbose) {
597
+ const putArgs = { repo: did, collection: CAP_COLLECTION, rkey, record, validate: false };
603
598
  vlog(
604
599
  JSON.stringify({
605
600
  ts: now,
606
601
  pds: session.serverMetadata?.issuer,
607
602
  xrpc: 'com.atproto.repo.putRecord',
608
603
  request: putArgs,
609
- response: putRes.data,
604
+ response,
610
605
  }),
611
606
  );
612
607
  }
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() {
package/src/lib/cap.js ADDED
@@ -0,0 +1,73 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright (c) 2026 sol pbc
3
+
4
+ import { TID } from '@atproto/common-web';
5
+ import { CAP_COLLECTION } from './constants.js';
6
+ import { resolveRef } from './cap-ref.js';
7
+
8
+ export async function publishCap(agent, input) {
9
+ if (input.repo == null || input.repo !== agent.did) {
10
+ throw new Error('write target must match authenticated agent');
11
+ }
12
+ if (input.swapCid != null && input.rkey == null) {
13
+ throw new Error('swap CID requires an rkey');
14
+ }
15
+ if (input.reply) {
16
+ const { root, parent } = input.reply;
17
+ if (
18
+ !root
19
+ || !parent
20
+ || typeof root.uri !== 'string'
21
+ || typeof root.cid !== 'string'
22
+ || typeof parent.uri !== 'string'
23
+ || typeof parent.cid !== 'string'
24
+ ) {
25
+ throw new Error('reply must include valid root and parent references');
26
+ }
27
+ }
28
+ if (input.embed) {
29
+ const external = input.embed.external;
30
+ if (
31
+ !external
32
+ || typeof external.uri !== 'string'
33
+ || typeof external.title !== 'string'
34
+ || typeof external.description !== 'string'
35
+ ) {
36
+ throw new Error('embed must include a valid external value');
37
+ }
38
+ }
39
+
40
+ const record = {
41
+ $type: CAP_COLLECTION,
42
+ text: input.text || '',
43
+ title: input.title,
44
+ description: input.description,
45
+ ref: input.ref,
46
+ createdAt: input.createdAt,
47
+ };
48
+ if (input.beacon) record.beacon = input.beacon;
49
+ if (input.kind) record.kind = input.kind;
50
+ if (input.recap) record.recap = input.recap;
51
+ if (input.reply) record.reply = input.reply;
52
+ if (input.embed) record.embed = input.embed;
53
+
54
+ const rkey = input.rkey ?? TID.nextStr();
55
+ const putArgs = {
56
+ repo: input.repo,
57
+ collection: CAP_COLLECTION,
58
+ rkey,
59
+ record,
60
+ validate: false,
61
+ };
62
+ if (input.swapCid != null) putArgs.swapRecord = input.swapCid;
63
+
64
+ const putRes = await agent.com.atproto.repo.putRecord(putArgs);
65
+ return {
66
+ uri: putRes.data.uri,
67
+ cid: putRes.data.cid,
68
+ ref: resolveRef(record, putRes.data.cid),
69
+ rkey,
70
+ record,
71
+ response: putRes.data,
72
+ };
73
+ }