#!/usr/bin/env node const path = require('path'); const { spawnSync } = require('child_process'); const command = process.argv[2] || 'help'; const root = path.resolve(__dirname, '..'); if (command === 'install' || command === 'workspace') { const args = [path.join(root, 'install.js')]; if (command === 'workspace') args.push('--workspace'); args.push(...process.argv.slice(3)); const result = spawnSync(process.execPath, args, { stdio: 'inherit', cwd: process.cwd() }); process.exit(result.status || 0); } if (command === 'sample') { const result = spawnSync(process.execPath, [ path.join(root, 'mcp/src/tools/tihao-brief-sourcing-run.js'), '--collection-mode', 'sample', ...process.argv.slice(3) ], { stdio: 'inherit', cwd: process.cwd() }); process.exit(result.status || 0); } if (command === 'image' || command === 'fmode-image') { const result = spawnSync(process.execPath, [ path.join(root, 'mcp/src/tools/fmode-image-analysis.js'), ...process.argv.slice(3) ], { stdio: 'inherit', cwd: process.cwd() }); process.exit(result.status || 0); } console.log([ 'tihao commands:', ' tihao install Install plugin to user Claude directory', ' tihao workspace --smoke Install plugin into current workspace and run smoke', ' tihao sample --brief Run sample brief-to-blogger-list workflow', ' tihao image --image-path --prompt Analyze an image with Fmode Doubao vision', '', 'Legacy alias: tihao-sourcing' ].join('\n'));