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 from it! :)
at main 32 lines 1.0 kB view raw
1import { execSync } from 'node:child_process'; 2import { readFileSync } from 'node:fs'; 3import { dirname, join } from 'node:path'; 4import { fileURLToPath } from 'node:url'; 5import { describe, expect, it } from 'vitest'; 6 7const __filename = fileURLToPath(import.meta.url); 8const __dirname = dirname(__filename); 9const packageJson = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf-8')); 10 11describe('Tangled CLI', () => { 12 it('should display version', () => { 13 const output = execSync('npx tsx src/index.ts --version', { 14 encoding: 'utf-8', 15 cwd: join(__dirname, '..'), 16 }); 17 expect(output.trim()).toBe(packageJson.version); 18 }); 19 20 it('should display help', () => { 21 const output = execSync('npx tsx src/index.ts --help', { 22 encoding: 'utf-8', 23 cwd: join(__dirname, '..'), 24 }); 25 expect(output).toContain('A CLI for Tangled.org'); 26 expect(output).toContain('Usage:'); 27 }); 28 29 it('package.json should have correct name', () => { 30 expect(packageJson.name).toBe('tangled-cli'); 31 }); 32});