Something went wrong. Try again.
WIP: A simple cli for daily tangled use cases and AI integration. This is for my personal use right now, but happy if others get mileage fro forked from markbennett.ca/tangled-cli
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839import { Command } from 'commander';import { getCurrentRepoContext } from '../lib/context.js';
/** * Create the context command for debugging repository context resolution */export function createContextCommand(): Command { const context = new Command('context'); context.description('Show current repository context (debug)');
context.action(async () => { try { const repoContext = await getCurrentRepoContext();
if (!repoContext) { console.log('✗ Not in a Tangled repository'); console.log('\nTo use this repository with Tangled, add a tangled.org remote:'); console.log(' git remote add origin git@tangled.org:<did>/<repo>.git'); console.log('\nOr clone from tangled.org:'); console.log(' git clone git@tangled.org:<did>/<repo>.git'); process.exit(1); }
console.log('✓ Repository context resolved:\n'); console.log(` Owner: ${repoContext.owner} (${repoContext.ownerType})`); console.log(` Repository: ${repoContext.name}`); console.log(` Protocol: ${repoContext.protocol}`); console.log(` Remote: ${repoContext.remoteName} (${repoContext.remoteUrl})`); } catch (error) { console.error( `Failed to resolve context: ${error instanceof Error ? error.message : 'Unknown error'}` ); process.exit(1); } });
return context;}