feat: implement Doc-Bot automated documentation maintenance service#1
Open
feat: implement Doc-Bot automated documentation maintenance service#1
Conversation
Implement complete Doc-Bot service for automated documentation maintenance across GitLab and GitHub repositories. Major components: - Platform adapters for GitLab and GitHub with webhook handling - Cross-platform support (source on one platform, docs on another) - Event routing and slash command parsing (/doc-bot review, update, revise) - Agent orchestration using Anthropic Claude API - Workflows: triage, update, revise, review - Git operations manager for cloning and repository operations - Bounded concurrency task queue - Session store for agent context tracking - Docker deployment configuration Configuration: - Environment-based config with validation - Per-project .doc-bot.yaml configuration - Configurable trigger modes: auto, slash-command, hybrid - Style guide support https://claude.ai/code/session_01CpSeE6ZFbpxMHvSeGREdAC
Add 70 tests with mocked platform and agent implementations to test the orchestration logic without dependencies on external services. Test coverage: - Unit tests: * Task queue (concurrency, error handling, stats) * Session store (CRUD, expiration, cleanup) * Config loader (parsing, validation, pattern matching) * Event router (slash commands, event routing) * Platform resolver (URL resolution, platform lookup) * Agent prompts (template generation, output parsing) - Integration tests: * Workflow orchestration (triage, update, revise, review) * Workflow context creation * Cross-platform documentation scenarios Mocks implemented: - MockPlatform: Stub platform adapter with call tracking - MockAgentOrchestrator: Stub agent with configurable responses - MockGitManager: Stub git operations Test infrastructure: - Jest configuration with ts-jest - Test setup with environment variables - Coverage reporting - Cleanup handling for async resources Fixes: - Added destroy() method to SessionStore to clean up intervals - Used unref() on cleanup interval to prevent hanging in tests - Fixed async test patterns with proper await Coverage: 90%+ on core orchestration logic (workflows, router, prompts) https://claude.ai/code/session_01CpSeE6ZFbpxMHvSeGREdAC
Add comprehensive CI/CD pipeline with GitHub Actions: Workflows: - ci.yml: Main CI/CD pipeline * Build and test on every push/PR * Publish Docker images to Docker Hub * Tag 'next' on main branch pushes * Tag version + 'latest' on version tags * Multi-platform builds (amd64, arm64) - pr-checks.yml: Pull request validation * Code formatting checks * Linting * Tests * Build verification * Bundle size reporting - release.yml: Automated GitHub releases * Auto-generate changelog from commits * Create releases on version tags * Include Docker Hub links Docker Publishing: - Builds on: main branch, version tags - Image: docbot/docbot - Tags strategy: * main branch → next * v1.2.3 → 1.2.3, 1.2, 1, latest * Commit SHA tags for traceability - Multi-platform: linux/amd64, linux/arm64 - Build caching for faster builds Automation: - Dependabot configuration for npm, GitHub Actions, Docker - PR template for consistent contributions - Codecov integration for coverage tracking Documentation: - CONTRIBUTING.md with developer guidelines - GitHub Actions workflow documentation Configuration: - Updated .dockerignore to exclude test files - Updated package.json format script for tests Required secrets: - DOCKER_USERNAME: Docker Hub username - DOCKER_PASSWORD: Docker Hub access token https://claude.ai/code/session_01CpSeE6ZFbpxMHvSeGREdAC
The previous documentation incorrectly implied that group-level webhooks (a GitLab Premium/Ultimate feature) were required. This is misleading as the webhook handler works perfectly with project-level webhooks. Changes: - Make project-level webhooks the primary option for GitLab - Move group-level webhooks to Option 2, clearly marked as Premium/Ultimate - Add detailed webhook configuration steps for both platforms - Clarify that both options work identically - Update environment variable descriptions to reflect any access token type Technical note: The webhook handler in src/platform/gitlab/webhook.ts and src/webhook/server.ts only processes individual MR/comment events. There is no code that requires or benefits from group-level webhooks. Group-level webhooks are purely a convenience feature for users with GitLab Premium/Ultimate who want to configure webhooks once for multiple projects. Fixes issue where free-tier GitLab users would be blocked from using the service. https://claude.ai/code/session_01CpSeE6ZFbpxMHvSeGREdAC
Major Features: - Full file editing workflow with agent tools - Cross-repository documentation support - Task mode for iterative/manual operation - Comprehensive unit tests ## Agent Tools & Multi-turn Interactions Added file operation tools for Claude agent: - read_file: Read file contents with path traversal prevention - write_file: Write file contents securely - glob: Find files by pattern - grep: Search file contents with regex - list_directory: List directory contents Enhanced AgentOrchestrator: - Multi-turn interaction loop with tool use - Track modified files across turns - Proper tool execution and error handling - Cost tracking per turn ## Full Workflow Implementation Created update-full.ts workflow that: - Clones repositories (source and/or docs) - Runs agent with file operation tools enabled - Agent reads, analyzes, and edits documentation files - Commits changes and pushes to new branch - Creates PR/MR with auto-generated description Supports two modes: 1. Same-repo: Documentation in same repository as code 2. Cross-repo: Documentation in separate repository (even different platform!) Cross-repo features: - Automatic platform detection from repo URL - Multi-repo cloning with GitManager.cloneMultiple() - Cross-platform authentication (GitLab ↔ GitHub) - Creates PRs in the correct repository ## Task Mode (Interactive/Manual Operation) New operational mode for iterative documentation updates: Task Configuration (task/config.ts): - YAML-based configuration format - Specify repo, branch, base branch - Optional PR tracking (auto-populated) - Custom user instructions Task Executor (task/executor.ts): - Execute documentation updates from config - Auto-create PR on first run, update task config with PR number - Subsequent runs update the same PR - Dry-run mode for analysis without changes CLI (task-cli.ts): - `doc-bot-task init` - Create task configuration - `doc-bot-task run` - Execute task - `doc-bot-task run --dry-run` - Analyze changes only - `doc-bot-task status` - Show task status Use cases: - Development: Test doc updates before webhook deployment - Manual control: Review changes before PR creation - Batch processing: Handle multiple branches systematically - CI/CD integration: Run as part of existing pipelines ## Comprehensive Tests Unit tests added: - tests/unit/agent/tools.test.ts - File operation tools - tests/unit/task/config.test.ts - Task configuration - tests/unit/git/manager.test.ts - Git operations ## Documentation - Added .doc-bot-task.example.yaml - Example task configuration - Updated README.md with task mode documentation - Added IMPLEMENTATION_STATUS.md - Implementation details ## Dependencies - commander: CLI framework for task mode - glob: File pattern matching for agent tools ## Known Issues Minor TypeScript compilation errors in: - src/task/executor.ts: openMR signature needs adjustment - src/workflows/update-full.ts: openMR signature needs adjustment These are trivial fixes (use correct 2-param signature) and don't affect the core implementation. See IMPLEMENTATION_STATUS.md for details. https://claude.ai/code/session_01CpSeE6ZFbpxMHvSeGREdAC
- Fix openMR function signature in task/executor.ts and workflows/update-full.ts - Use correct 2-parameter signature: openMR(project, params) - Extract webUrl and mrId from MRResult - Fix PlatformResolver construction in task-cli.ts - Initialize platform adapters correctly - Use correct config property names (UPPERCASE) All TypeScript compilation errors resolved.
Contributor
Author
|
@claude fix this build |
- Fix glob/grep tools: remove promisify wrapper (glob already returns Promise) - Fix regex state issue in grepTool by creating new regex per file - Fix error handling in agent tools to work with jest environment - Fix git manager test mocking to avoid TypeScript strict typing issues - Add test directory setup/cleanup for git manager tests All 109 tests now passing successfully.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement complete Doc-Bot service for automated documentation maintenance across GitLab and GitHub repositories.
Major components:
Configuration:
https://claude.ai/code/session_01CpSeE6ZFbpxMHvSeGREdAC