open source is social v-it.org
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add -v/--verbose step-by-step output to ship, skim, beacon, and init

Adds [verbose] console.log messages at key workflow steps in each
command, following the existing pattern from login.js. Verbose output
narrates config loading, session restore, API calls, and file writes
without changing normal output.

+26 -1
+7 -1
src/cmd/beacon.js
··· 25 25 .command('beacon') 26 26 .description('Probe a remote repo for its beacon') 27 27 .argument('<target>', 'vit: URI or git URL to probe') 28 - .action(async (target) => { 28 + .option('-v, --verbose', 'Show step-by-step details') 29 + .action(async (target, opts) => { 29 30 try { 31 + const { verbose } = opts; 30 32 const url = beaconToHttps(target); 33 + if (verbose) console.log(`[verbose] Resolved URL: ${url}`); 31 34 const { fs } = memfs(); 32 35 const dir = '/'; 33 36 37 + if (verbose) console.log(`[verbose] Cloning (depth=1)...`); 34 38 await git.clone({ fs, http, dir, url, depth: 1, singleBranch: true, noCheckout: true }); 35 39 36 40 const head = await git.resolveRef({ fs, dir, ref: 'HEAD' }); 41 + if (verbose) console.log(`[verbose] HEAD resolved: ${head}`); 37 42 const commit = await git.readObject({ fs, dir, oid: head, format: 'parsed' }); 38 43 const content = await readTreeFile(fs, dir, commit.object.tree, ['.vit', 'config.json']); 44 + if (verbose) console.log(`[verbose] Read .vit/config.json: ${content ? 'found' : 'not found'}`); 39 45 40 46 let beacon; 41 47 try {
+6
src/cmd/init.js
··· 11 11 .command('init') 12 12 .description('Initialize .vit directory and set project beacon. Use the most official upstream or well-known git URL so all contributors converge on the same beacon.') 13 13 .option('--beacon <url>', 'Git URL (or "." to read from git remote origin) to derive the beacon URI') 14 + .option('-v, --verbose', 'Show step-by-step details') 14 15 .action(async (opts) => { 15 16 try { 17 + const { verbose } = opts; 16 18 const dir = vitDir(); 19 + if (verbose) console.log(`[verbose] .vit dir: ${dir}`); 17 20 18 21 if (!opts.beacon) { 19 22 const config = readProjectConfig(); ··· 34 37 encoding: 'utf-8', 35 38 stdio: ['pipe', 'pipe', 'pipe'], 36 39 }).trim(); 40 + if (verbose) console.log(`[verbose] Read git remote origin: ${gitUrl}`); 37 41 } catch { 38 42 console.error('No git remote origin found. Set a remote or provide a git URL directly.'); 39 43 process.exitCode = 1; ··· 47 51 } 48 52 49 53 const beacon = 'vit:' + toBeacon(gitUrl); 54 + if (verbose) console.log(`[verbose] Computed beacon: ${beacon}`); 50 55 writeProjectConfig({ beacon }); 56 + if (verbose) console.log(`[verbose] Wrote config.json`); 51 57 console.log(`beacon: ${beacon}`); 52 58 } catch (err) { 53 59 console.error(err.message);
+7
src/cmd/ship.js
··· 11 11 program 12 12 .command('ship <text>') 13 13 .description('Write a cap to the authenticated PDS') 14 + .option('-v, --verbose', 'Show step-by-step details') 14 15 .option('--did <did>', 'DID to use (reads saved DID from config if not provided)') 15 16 .action(async (text, opts) => { 16 17 try { 18 + const { verbose } = opts; 17 19 const envDid = loadConfig().did; 18 20 const did = opts.did || envDid; 21 + if (verbose) console.log(`[verbose] Config loaded, DID: ${did}`); 19 22 20 23 const clientId = `http://localhost?redirect_uri=${encodeURIComponent('http://127.0.0.1')}&scope=${encodeURIComponent('atproto transition:generic')}`; 21 24 const sessionStore = createSessionStore(); ··· 30 33 redirectUri: 'http://127.0.0.1', 31 34 }); 32 35 const session = await client.restore(did); 36 + if (verbose) console.log(`[verbose] Session restored, PDS: ${session.serverMetadata?.issuer}`); 33 37 const agent = new Agent(session); 34 38 35 39 const record = { ··· 38 42 createdAt: new Date().toISOString(), 39 43 }; 40 44 const rkey = TID.nextStr(); 45 + if (verbose) console.log(`[verbose] Record built, rkey: ${rkey}`); 41 46 const putArgs = { 42 47 repo: did, 43 48 collection: 'org.v-it.cap', ··· 45 50 record, 46 51 validate: false, 47 52 }; 53 + if (verbose) console.log(`[verbose] putRecord ${putArgs.collection} rkey=${rkey}`); 48 54 const putRes = await agent.com.atproto.repo.putRecord(putArgs); 49 55 try { 50 56 appendLog('caps.jsonl', { ··· 59 65 } catch (logErr) { 60 66 console.error('warning: failed to write caps.jsonl:', logErr.message); 61 67 } 68 + if (verbose) console.log(`[verbose] Log written to caps.jsonl`); 62 69 console.log( 63 70 JSON.stringify({ 64 71 ts: new Date().toISOString(),
+6
src/cmd/skim.js
··· 11 11 .description('List caps from the authenticated PDS') 12 12 .option('--did <did>', 'DID to use (reads saved DID from config if not provided)') 13 13 .option('--limit <n>', 'Max records to return', '25') 14 + .option('-v, --verbose', 'Show step-by-step details') 14 15 .action(async (opts) => { 15 16 try { 17 + const { verbose } = opts; 16 18 const envDid = loadConfig().did; 17 19 const did = opts.did || envDid; 20 + if (verbose) console.log(`[verbose] Config loaded, DID: ${did}`); 18 21 19 22 const clientId = `http://localhost?redirect_uri=${encodeURIComponent('http://127.0.0.1')}&scope=${encodeURIComponent('atproto transition:generic')}`; 20 23 const sessionStore = createSessionStore(); ··· 29 32 redirectUri: 'http://127.0.0.1', 30 33 }); 31 34 const session = await client.restore(did); 35 + if (verbose) console.log(`[verbose] Session restored, PDS: ${session.serverMetadata?.issuer}`); 32 36 const agent = new Agent(session); 33 37 34 38 const listArgs = { ··· 36 40 collection: 'org.v-it.cap', 37 41 limit: parseInt(opts.limit, 10), 38 42 }; 43 + if (verbose) console.log(`[verbose] listRecords ${listArgs.collection} limit=${listArgs.limit}`); 39 44 const listRes = await agent.com.atproto.repo.listRecords(listArgs); 45 + if (verbose) console.log(`[verbose] Received ${listRes.data.records.length} records`); 40 46 for (const rec of listRes.data.records) { 41 47 console.log( 42 48 JSON.stringify({