tihao.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/usr/bin/env node
  2. const path = require('path');
  3. const { spawnSync } = require('child_process');
  4. const command = process.argv[2] || 'help';
  5. const root = path.resolve(__dirname, '..');
  6. if (command === 'install' || command === 'workspace') {
  7. const args = [path.join(root, 'install.js')];
  8. if (command === 'workspace') args.push('--workspace');
  9. args.push(...process.argv.slice(3));
  10. const result = spawnSync(process.execPath, args, { stdio: 'inherit', cwd: process.cwd() });
  11. process.exit(result.status || 0);
  12. }
  13. if (command === 'sample') {
  14. const result = spawnSync(process.execPath, [
  15. path.join(root, 'mcp/src/tools/tihao-brief-sourcing-run.js'),
  16. '--collection-mode',
  17. 'sample',
  18. ...process.argv.slice(3)
  19. ], { stdio: 'inherit', cwd: process.cwd() });
  20. process.exit(result.status || 0);
  21. }
  22. if (command === 'image' || command === 'fmode-image') {
  23. const result = spawnSync(process.execPath, [
  24. path.join(root, 'mcp/src/tools/fmode-image-analysis.js'),
  25. ...process.argv.slice(3)
  26. ], { stdio: 'inherit', cwd: process.cwd() });
  27. process.exit(result.status || 0);
  28. }
  29. console.log([
  30. 'tihao commands:',
  31. ' tihao install Install plugin to user Claude directory',
  32. ' tihao workspace --smoke Install plugin into current workspace and run smoke',
  33. ' tihao sample --brief <file> Run sample brief-to-blogger-list workflow',
  34. ' tihao image --image-path <file> --prompt <text> Analyze an image with Fmode Doubao vision',
  35. '',
  36. 'Legacy alias: tihao-sourcing'
  37. ].join('\n'));