Skip to content

feat: auto issue/PR creation with AI-enhanced reports#38

Merged
elky-bachtiar merged 21 commits intomainfrom
feat/auto-issue-pr-creation
Mar 18, 2026
Merged

feat: auto issue/PR creation with AI-enhanced reports#38
elky-bachtiar merged 21 commits intomainfrom
feat/auto-issue-pr-creation

Conversation

@elky-bachtiar
Copy link
Copy Markdown
Owner

Summary

  • Add --create-issues and --create-pr CLI flags for automated GitHub/GitLab issue and PR/MR creation from VlamGuard findings
  • Add platform detection, fix application, and integration layer for both GitHub and GitLab
  • Add GitHub Actions and GitLab CI workflows with vlam-proxy for AI-powered reports
  • Surface AI failure reasons with actionable error messages instead of generic errors

Test plan

  • 186 AI/CLI tests passing
  • Unit, integration, and E2E test coverage
  • Verify GitLab CI pipeline runs with vlam-proxy
  • Verify GitHub Actions workflow runs successfully

…models

- Platform StrEnum: github / gitlab
- PlatformInfo carries CLI command, body flag, term (PR vs MR) and remote metadata
- FixApplied records per-check manifest patches with optional before/after snippets
- ReportResponse wraps AnalyzeResponse with issue_url, pr_url, fixes and unfixed lists
- 17 unit tests cover all models, required-field validation, defaults, and enum coercion
- Implements IntegrationError base with PlatformError, IssueCreationError, PRCreationError subclasses
- get_timeout() reads VLAM_INTEGRATION_TIMEOUT env with fallback to 60s
- run_cmd() wraps subprocess.run with capture, text mode, timeout, and check=True
- 20 unit tests covering hierarchy, message preservation, env handling, and subprocess behaviour
- detect_platform() inspects git remote URL and maps to Platform.GITHUB/GITLAB
- Supports HTTPS, standard SSH, and SSH config aliases (github-*, gitlab-*)
- Validates gh/glab CLI is available before returning PlatformInfo
- platform_override bypasses URL detection when caller knows the platform
- 35 tests covering happy paths, SSH aliases, custom remotes, and all error branches
When using --chart flag, manifests is None so PR creation would fail.
Now falls back to chart + /values.yaml path, matching the report command.
- GitHub Actions: matrix strategy runs VlamGuard on 6 demo charts
- GitLab CI: 6 report jobs extending .vlamguard-report template
- Both start vlam-proxy as background service for AI analysis
- Proxy translates between OpenAI format and vlam.ai custom format
- Include vlam-proxy source (proxy.py, requirements.txt) in repo
- Move VLAM_URL, VLAM_KEY, PROXY_PORT, SSL_VERIFY to workflow-level env
  so background proxy process inherits them across steps
- Use secrets.VLAM_AI_MODEL instead of vars (user has it as secret)
- Add proxy startup failure detection with log output
- Add "Show proxy logs on failure" step for debugging
- Remove fallback defaults for PROXY_PORT (secret is always set)
The old releases download URL no longer serves valid .deb files.
Use the GitLab packages API URL which returns the actual package.
- Reorder CLI: run integrations (issue/PR) before writing output file,
  so the report JSON doesn't make the working tree dirty for PR creation
- Remove self-referencing GitLab CI variables that resolved as literals
  (e.g. PROXY_PORT="${PROXY_PORT}"); CI/CD settings vars are already
  available without re-declaration
…l ruamel.yaml

- Use --body-file instead of --body to avoid CLI argument length limits
- Add --base/--target-branch to explicitly set PR target branch
- Capture subprocess stderr in PR creation error messages for diagnostics
- Install ruamel.yaml in CI so YAML comments are preserved during fixes
Upgraded AI client logging from debug to warning level so timeout,
HTTP, and parse errors are visible in CI without --debug flag. Improved
CLI error message to list common failure causes and point to --debug.
Add tests for pull_requests.py, main.py, ai/context.py, and cli.py
to cover uncovered paths including error handling, GitLab flows,
PyYAML fallback, and the improved AI failure error message.
Fix ANSI escape issue in CLI flag tests with NO_COLOR env var.
@elky-bachtiar elky-bachtiar merged commit 2436a92 into main Mar 18, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant