Spaces:
Paused
Paused
Download src/cli.ts from delqhi/sin-github-issues: direct link, hf CLI and curl.
- Browser
- Download file 1.16 kB
-
https://huggingface.co/spaces/delqhi/sin-github-issues/resolve/refs%2Fpr%2F1/src/cli.ts
- Command line
-
hf download hf://spaces/delqhi/sin-github-issues@refs/pr/1/src/cli.ts
-
curl -L -o cli.ts https://huggingface.co/spaces/delqhi/sin-github-issues/resolve/refs%2Fpr%2F1/src/cli.ts
1.16 kB
| import { readFileSync } from 'node:fs'; | |
| import { resolve } from 'node:path'; | |
| import { createTemplateAgentHttpServer } from './a2a-http.js'; | |
| import { runMcpServer } from './mcp-server.js'; | |
| import { executeGitHubAgentAction } from './runtime.js'; | |
| const cmd = process.argv[2]; | |
| if (cmd === 'serve-a2a') { | |
| createTemplateAgentHttpServer().start().catch(err => { | |
| console.error(err); | |
| process.exit(1); | |
| }); | |
| } else if (cmd === 'serve-mcp') { | |
| runMcpServer().catch(err => { | |
| console.error(err); | |
| process.exit(1); | |
| }); | |
| } else if (cmd === 'print-card') { | |
| const cardPath = resolve(process.cwd(), 'A2A-CARD.md'); | |
| console.log(readFileSync(cardPath, 'utf8')); | |
| } else if (cmd === 'run-action') { | |
| const payload = process.argv[3]; | |
| if (!payload) { | |
| console.error('Usage: run-action \'{"action":"sin.github.health"}\''); | |
| process.exit(1); | |
| } | |
| executeGitHubAgentAction(JSON.parse(payload)) | |
| .then(res => console.log(JSON.stringify(res, null, 2))) | |
| .catch(err => { | |
| console.error(err); | |
| process.exit(1); | |
| }); | |
| } else { | |
| console.error('Usage: <cli> [serve-mcp|print-card|run-action]'); | |
| process.exit(1); | |
| } | |