# Agent Manager Client TypeScript-based Claude Agent SDK client for automated issue handling in Gogs repositories. ## Overview This client uses the [@anthropic-ai/claude-agent-sdk](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk) to provide AI-powered issue automation. It replaces the previous bash-based Claude Code implementation with a more robust, type-safe TypeScript solution. ## Features - **TypeScript Implementation**: Fully typed code with compile-time safety - **MCP Integration**: Connects to gogs-mcp server for Gogs API operations - **Issue Automation**: Automatically handles issues assigned to Claude - **Comment Processing**: Responds to issue comments and updates - **Environment-Specific Configuration**: Supports different gogs-mcp paths via environment variables ## Architecture ``` client/ ├── src/ │ ├── claude-client.ts # Main Claude Agent SDK client │ ├── config.ts # Configuration management │ ├── types.ts # TypeScript type definitions │ └── index.ts # CLI entry point ├── dist/ # Compiled JavaScript (generated) ├── package.json # Dependencies and scripts └── tsconfig.json # TypeScript configuration ``` ## Installation ```bash cd client npm install ``` ## Building ```bash npm run build ``` This compiles TypeScript to JavaScript in the `dist/` directory. ## Usage ### Programmatic API ```typescript import { ClaudeClient } from './client/dist/index.js'; const client = new ClaudeClient({ workingDirectory: '/path/to/repo', mcpConfigPath: '/path/to/repo/.mcp-gogs.json', allowedTools: ['mcp__gogs__get_issue', 'mcp__gogs__create_issue_comment', 'Read', 'Write'], dangerouslySkipPermissions: true }); const result = await client.handleIssue({ owner: 'username', repo: 'repo-name', number: 42, title: 'Issue title', body: 'Issue description', action: 'opened', pusher: 'username', assignee: 'claude' }); console.log(result); ``` ### Command Line ```bash node dist/index.js [comment_body] [assignee] ``` ### Webhook Integration The client is integrated with the webhook server via `scripts/handle-issue-ts.sh`, which is called from `commands.json` for issue and issue_comment events. ## Configuration The client reads configuration from the repository's `.env` file: ```env GOGS_MCP_PATH=/data/gogs-mcp/dist/index.js ``` ## MCP Tools The client has access to all gogs MCP tools: **User Tools:** - `mcp__gogs__get_current_user` - `mcp__gogs__get_user` - `mcp__gogs__search_users` **Repository Tools:** - `mcp__gogs__list_user_repositories` - `mcp__gogs__search_repositories` - `mcp__gogs__get_repository` - `mcp__gogs__create_repository` - `mcp__gogs__delete_repository` **Content Tools:** - `mcp__gogs__get_contents` - `mcp__gogs__get_raw_content` - `mcp__gogs__list_branches` - `mcp__gogs__get_commits` **Issue Tools:** - `mcp__gogs__list_issues` - `mcp__gogs__get_issue` - `mcp__gogs__create_issue` - `mcp__gogs__update_issue` - `mcp__gogs__list_issue_comments` - `mcp__gogs__create_issue_comment` - `mcp__gogs__update_issue_comment` **File Tools:** - `Read`, `Write`, `Edit`, `Bash`, `Grep`, `Glob`, `TodoWrite` ## Development ### Watch Mode ```bash npm run watch ``` ### Clean Build ```bash npm run clean npm run build ``` ## Requirements - Node.js >= 18.0.0 - TypeScript >= 5.3.0 - @anthropic-ai/claude-agent-sdk >= 0.1.28 ## License ISC