Skip to content

feat(als): integrate apme as diagnostics provider#2772

Draft
ganeshrn wants to merge 1 commit intoansible:mainfrom
ganeshrn:feat/apme-integration
Draft

feat(als): integrate apme as diagnostics provider#2772
ganeshrn wants to merge 1 commit intoansible:mainfrom
ganeshrn:feat/apme-integration

Conversation

@ganeshrn
Copy link
Copy Markdown
Member

Summary

  • Integrates apme (Ansible Policy & Modernization Engine) as a third diagnostics tool in the Ansible Language Server
  • Surfaces apme's three-tier violation model (auto-fixable, ai-candidate, manual-review) as LSP diagnostics with code actions
  • Adds "Migrate with apme" command for bulk project remediation
  • Includes status bar indicator, clickable rule links, and configurable dedup with ansible-lint

Changes

New files:

  • packages/ansible-language-server/src/services/ansibleApme.ts — AnsibleApme service (validation, workspace scan, remediation with per-file lock)
  • packages/ansible-language-server/src/providers/codeActionProvider.ts — Quick fix code actions for Tier 1 violations
  • packages/ansible-language-server/test/services/ansibleApme.test.ts — 15 unit tests for JSON parser

Modified files:

  • package.json — apme settings, "Migrate with apme" command, explorer context menu
  • src/extension.ts — Migrate command handler, status bar indicator
  • packages/ansible-language-server/src/ansibleLanguageService.ts — Code action handler, remediate request handlers, workspace scan on startup
  • packages/ansible-language-server/src/interfaces/extensionSettings.ts — apme settings types
  • packages/ansible-language-server/src/providers/validationProvider.ts — apme validation step + diagnostic dedup
  • packages/ansible-language-server/src/services/settingsManager.ts — apme setting defaults
  • packages/ansible-language-server/src/services/workspaceManager.ts — ansibleApme lazy getter

New settings

Setting Default Description
ansible.validation.apme.enabled false Enable apme static analysis
ansible.validation.apme.path "apme" Path to apme executable
ansible.validation.apme.arguments "" Extra CLI arguments
ansible.validation.apme.autoFixOnSave false Auto-fix Tier 1 violations on save
ansible.validation.diagnosticPrecedence "both" Dedup: both, apme, or lint

Test plan

  • apme diagnostics appear as squiggles in editor
  • Problems panel shows violations with tier labels
  • Hover shows rule ID + message
  • "Migrate with apme" works from command palette and right-click context menu
  • Status bar shows violation count
  • Rule IDs are clickable links
  • Workspace auto-scan on open
  • 15 unit tests pass
  • Auto-fix on save end-to-end test
  • Integration tests with apme daemon

🤖 Generated with Claude Code

Add apme (Ansible Policy & Modernization Engine) as a third diagnostics
tool in the Ansible Language Server alongside ansible-lint and
ansible-playbook --syntax-check.

New capabilities:
- AnsibleApme service: per-file and workspace-level validation via
  `apme check --json`, with three-tier violation classification
  (auto-fixable, ai-candidate, manual-review)
- CodeActionProvider: "Fix all apme violations" quick fix for Tier 1
- Auto-fix on save: opt-in setting to auto-remediate deterministic
  violations
- Workspace scan on startup: async background scan for project-wide
  violations
- "Migrate with apme" command: command palette + explorer context menu
  for bulk remediation
- Status bar indicator: violation count with click-to-problems
- Diagnostic dedup: configurable precedence when both apme and
  ansible-lint report on the same line
- Clickable rule IDs linking to apme documentation
- Tier labels in diagnostic messages ([auto-fixable], [ai-candidate])
- Per-file remediation lock to prevent concurrent writes

Settings: ansible.validation.apme.enabled, .path, .arguments,
.autoFixOnSave, ansible.validation.diagnosticPrecedence

Includes 15 unit tests for the JSON parser covering severity mapping,
tier classification, file path handling, and edge cases.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

Label error. Requires at least 1 of: breaking, chore, feat, fix. Found: . Follow https://www.conventionalcommits.org to get auto-labeling to work correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant