Skip to content

feat(adt-pilot): @abapify/adt-pilot — Mastra-based ABAP code review (workflow + harness)#116

Open
Copilot wants to merge 7 commits intomainfrom
copilot/implement-abapify-pilot-agent
Open

feat(adt-pilot): @abapify/adt-pilot — Mastra-based ABAP code review (workflow + harness)#116
Copilot wants to merge 7 commits intomainfrom
copilot/implement-abapify-pilot-agent

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 29, 2026

Summary

Introduces @abapify/adt-pilot, a Mastra-powered ABAP code-review package built on @abapify/adt-mcp. Two complementary modes share the same MCP-backed implementation:

Workflow mode — deterministic, no LLM

createCodeReviewWorkflow(callTool) returns a Mastra workflow with exactly three steps:

resolveObjects  →  runAtcChecks  →  buildReport
  • Package mode — calls list_package_objects and extracts every objects[].uri to feed atc_run.
  • Transport mode — calls cts_get_transport to validate the transport, then uses the transport URI (/sap/bc/adt/cts/transportrequests/{number}) as the ATC target so SAP's ATC server enumerates contained objects (matches adt check --transport <number>).
  • Per-object errors are captured as synthetic priority: 'error' findings; the workflow always completes with a CodeReviewReport.
  • Discriminated-union input schema: { mode: 'package' | 'transport', ...connection } with full Zod validation.
const workflow = createCodeReviewWorkflow(callTool);
const run = await workflow.createRun(); // async!
const result = await run.start({
  inputData: {
    mode: 'transport',
    transportNumber: 'DEVK900001',
    baseUrl: 'https://sap.example.com',
    username: 'DEVELOPER',
    password: '...',
  },
});
if (result.status === 'success') {
  console.log(result.result); // CodeReviewReport
}

Harness mode — interactive via Mastra Agent

createAbapifyPilot(config) returns a Mastra Harness with a review mode powered by an Agent wired to list_package_objects, atc_run, and cts_get_transport. Optional custom instructions and pre-loaded MCP tools.

Public API

Narrow handles CodeReviewWorkflow / CodeReviewRun / CodeReviewRunResult deliberately erase Mastra's deeply generic types, both to keep the consumer-facing surface readable and to avoid tsc OOM during typecheck and DTS bloat during build.

Build & test hygiene

  • typecheck target overridden in project.json to tsc -p tsconfig.lib.json --noEmit so it does not follow project references — adt-mcp's typecheck (MCP SDK + Zod inference) is known to OOM and propagated through tsc --build.
  • @abapify/adt-mcp moved from runtime dependencies to devDependencies (it's only imported in tests; production consumers spawn their own MCP server via stdio/HTTP transport).
  • @modelcontextprotocol/sdk promoted to a runtime dependency (used by mcp-client.ts).
  • tsconfig.spec.json added so test-only deps live in the spec config.

Tests (28 total, all passing)

  • workflow.test.ts — async createRun() API; package mode (happy path + empty package), transport mode (happy path + URI assertion), single + multi-object error paths, transport-lookup failure
  • types.test.ts — Zod schema parse/reject edge cases; credentials generated via randomBytes; URLs use https:// to clear SonarCloud hotspots
  • harness.test.ts (new) — factory smoke tests for createAbapifyPilot and createReviewAgent
  • mcp-client.test.ts — MCP tool caller unit tests

Review & Testing Checklist for Human

  • Run the full local check suite end-to-end: bunx nx run-many -t build test lint typecheck -p adt-pilot should produce 0 failures (28 tests pass locally).
  • Verify both modes against a real SAP system: a minimal script that invokes createCodeReviewWorkflow(callTool) once with mode: 'package' and once with mode: 'transport', both pointing at a known package / transport, and confirm result.result.findings is non-empty when ATC has known issues.
  • Smoke-test harness mode: createAbapifyPilot({ mcpClientConfig }), send a natural-language "review package ZSOMETHING" message, and confirm the agent calls list_package_objects then atc_run.
  • Confirm @abapify/adt-mcp being a devDependency (not a runtime dep) is acceptable for downstream consumers — production users now bring their own MCP server transport.

Notes

  • Mastra's Workflow and Step types are intentionally type-erased at the import boundary in src/workflow.ts (see "Internal type-erasure aliases"). Runtime correctness is enforced by Zod schemas; the public TypeScript API is narrowed via CodeReviewWorkflow/CodeReviewRun interfaces. Without this, tsc OOMs at >4 GB even with --noEmit, and rolldown-plugin-dts produces multi-megabyte declarations.
  • bunx nx sync will keep tsconfig.lib.json references to ../adt-client, ../adt-mcp, ../adt-fixtures in sync because those packages appear in the project graph (via test imports). They are harmless because the overridden typecheck command does not follow references, and tsdown builds with dts: false.
  • All test credentials are generated per-process via node:crypto.randomBytes — no hardcoded passwords remain.

Link to Devin session: https://app.devin.ai/sessions/cccf1bebf740444aaf1d5d36b97a9f4d
Requested by: @ThePlenkov

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 29, 2026

Deploy Preview for adt-cli canceled.

Name Link
🔨 Latest commit ffa6346
🔍 Latest deploy log https://app.netlify.com/projects/adt-cli/deploys/69f42436dead93000879a567

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented Apr 29, 2026

View your CI Pipeline Execution ↗ for commit d819a8d

Command Status Duration Result
nx affected -t lint test build e2e-ci --verbose... ✅ Succeeded 2m 51s View ↗

☁️ Nx Cloud last updated this comment at 2026-05-01 03:59:03 UTC

devin-ai-integration Bot and others added 2 commits April 30, 2026 13:21
Workflow mode (deterministic, no LLM):
- Three-step pipeline: resolveObjects -> runAtcChecks -> buildReport
- Discriminated-union input schema with 'package' or 'transport' modes
- Package mode enumerates objects via list_package_objects MCP tool
- Transport mode validates via cts_get_transport, uses transport URI as
  ATC target (server-side enumeration matches 'adt check --transport')
- Per-object error capture: failed ATC runs become priority='error'
  findings; the workflow never aborts on a single failure

Harness mode (interactive via Mastra Agent):
- createAbapifyPilot(config) returns a Mastra Harness with a 'review' mode
- Review agent wired with list_package_objects, atc_run, cts_get_transport
- Optional custom instructions and pre-loaded MCP tools

Type/build hygiene:
- Type-erase Mastra workflow + step factories at the import boundary;
  Mastra's deeply generic types caused tsc OOM and DTS bloat
- Public API surfaces narrow CodeReviewWorkflow / CodeReviewRun handles
- typecheck target overridden to 'tsc -p tsconfig.lib.json --noEmit' so
  tsc does not follow project references (avoids adt-mcp typecheck OOM)
- Move @abapify/adt-mcp from runtime deps to devDeps (only used in tests)
- Promote @modelcontextprotocol/sdk to a runtime dep (used by mcp-client)

Tests (28 total, all passing):
- workflow.test.ts: rewritten for async createRun() API; covers package
  mode happy path + empty package, transport mode happy path + URI
  assertion, single + multi-object error paths, transport-lookup failure
- types.test.ts: schema validation; credentials generated via randomBytes
- harness.test.ts (new): factory smoke tests for Harness + Agent
- mcp-client.test.ts: unchanged (still passing)

Security:
- All test credentials generated per-process with randomBytes (no more
  hardcoded 'secret'/'test-password' strings flagged by SonarCloud)

Co-Authored-By: Petr Plenkov <petr.plenkov@gmail.com>
…tspots

SonarCloud (rule typescript:S5332) flagged 'http://sap:8000' string literals
in tests/types.test.ts as security hotspots. Switch the example baseUrls in
both tests and JSDoc to 'https://sap.example.com' / 'https://my-sap.example.com'.

The localhost URL in workflow.test.ts is intentional (in-process mock server)
and is not flagged by the rule.

Co-Authored-By: Petr Plenkov <petr.plenkov@gmail.com>
@devin-ai-integration devin-ai-integration Bot changed the title feat(adt-pilot): add @abapify/adt-pilot — Mastra AI agent for ABAP code review via ADT MCP feat(adt-pilot): @abapify/adt-pilot — Mastra-based ABAP code review (workflow + harness) Apr 30, 2026
@ThePlenkov ThePlenkov marked this pull request as ready for review May 1, 2026 03:23
Copilot AI review requested due to automatic review settings May 1, 2026 03:23
@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

feat(adt-pilot): Mastra-based ABAP code review workflow and harness

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Introduces @abapify/adt-pilot, a Mastra-powered ABAP code review package
• Implements deterministic workflow with three-step pipeline: resolveObjects → runAtcChecks →
  buildReport
• Supports package and transport modes with discriminated-union input schema
• Provides interactive Harness with review agent wired to MCP tools
• Includes comprehensive test suite (28 tests) with mock ADT server integration
Diagram
flowchart LR
  Input["Input: Package or Transport"] --> Resolve["resolveObjects Step"]
  Resolve --> ListPkg["list_package_objects MCP"]
  Resolve --> CtsGet["cts_get_transport MCP"]
  ListPkg --> Objects["Object URIs"]
  CtsGet --> Objects
  Objects --> RunAtc["runAtcChecks Step"]
  RunAtc --> AtcRun["atc_run MCP per object"]
  AtcRun --> Results["ATC Results + Errors"]
  Results --> BuildReport["buildReport Step"]
  BuildReport --> Report["CodeReviewReport"]
  Report --> Output["findings, summary, mode, target"]
  Input -.-> Harness["Harness + Review Agent"]
  Harness --> Agent["Mastra Agent with MCP tools"]
Loading

Grey Divider

File Changes

1. packages/adt-pilot/src/types.ts Types +106/-0

Define public types for code review

packages/adt-pilot/src/types.ts


2. packages/adt-pilot/src/workflow.ts ✨ Enhancement +559/-0

Implement three-step code review workflow

packages/adt-pilot/src/workflow.ts


3. packages/adt-pilot/src/mcp-client.ts ✨ Enhancement +112/-0

Wrap MCP SDK client for tool invocation

packages/adt-pilot/src/mcp-client.ts


View more (21)
4. packages/adt-pilot/src/agent.ts ✨ Enhancement +76/-0

Create Mastra review agent with instructions

packages/adt-pilot/src/agent.ts


5. packages/adt-pilot/src/harness.ts ✨ Enhancement +63/-0

Factory for Mastra Harness with review mode

packages/adt-pilot/src/harness.ts


6. packages/adt-pilot/src/index.ts 📝 Documentation +95/-0

Export public API and documentation

packages/adt-pilot/src/index.ts


7. packages/adt-pilot/tests/workflow.test.ts 🧪 Tests +299/-0

Integration tests for workflow modes

packages/adt-pilot/tests/workflow.test.ts


8. packages/adt-pilot/tests/types.test.ts 🧪 Tests +131/-0

Zod schema validation tests

packages/adt-pilot/tests/types.test.ts


9. packages/adt-pilot/tests/mcp-client.test.ts 🧪 Tests +82/-0

Unit tests for MCP tool caller

packages/adt-pilot/tests/mcp-client.test.ts


10. packages/adt-pilot/tests/harness.test.ts 🧪 Tests +65/-0

Smoke tests for harness factory

packages/adt-pilot/tests/harness.test.ts


11. packages/adt-pilot/package.json ⚙️ Configuration changes +47/-0

Configure package metadata and dependencies

packages/adt-pilot/package.json


12. packages/adt-pilot/project.json ⚙️ Configuration changes +30/-0

Define Nx build and typecheck targets

packages/adt-pilot/project.json


13. packages/adt-pilot/tsconfig.json ⚙️ Configuration changes +13/-0

Configure TypeScript project references

packages/adt-pilot/tsconfig.json


14. packages/adt-pilot/tsconfig.lib.json ⚙️ Configuration changes +22/-0

Configure library compilation settings

packages/adt-pilot/tsconfig.lib.json


15. packages/adt-pilot/tsconfig.spec.json ⚙️ Configuration changes +19/-0

Configure test-only TypeScript settings

packages/adt-pilot/tsconfig.spec.json


16. packages/adt-pilot/tsdown.config.ts ⚙️ Configuration changes +15/-0

Configure build with DTS disabled for OOM

packages/adt-pilot/tsdown.config.ts


17. packages/adt-pilot/vitest.config.ts ⚙️ Configuration changes +8/-0

Configure Vitest with Node environment

packages/adt-pilot/vitest.config.ts


18. openspec/changes/add-abapify-pilot/.openspec.yaml 📝 Documentation +2/-0

OpenSpec metadata for pilot feature

openspec/changes/add-abapify-pilot/.openspec.yaml


19. openspec/changes/add-abapify-pilot/proposal.md 📝 Documentation +31/-0

Feature proposal and capabilities

openspec/changes/add-abapify-pilot/proposal.md


20. openspec/changes/add-abapify-pilot/design.md 📝 Documentation +71/-0

Design decisions and trade-offs

openspec/changes/add-abapify-pilot/design.md


21. openspec/changes/add-abapify-pilot/specs/code-review-workflow/spec.md 📝 Documentation +86/-0

Workflow requirements and scenarios

openspec/changes/add-abapify-pilot/specs/code-review-workflow/spec.md


22. openspec/changes/add-abapify-pilot/specs/abapify-pilot-agent/spec.md 📝 Documentation +47/-0

Harness and agent requirements

openspec/changes/add-abapify-pilot/specs/abapify-pilot-agent/spec.md


23. openspec/changes/add-abapify-pilot/tasks.md 📝 Documentation +59/-0

Implementation tasks and checklist

openspec/changes/add-abapify-pilot/tasks.md


24. tsconfig.json ⚙️ Configuration changes +3/-0

Add adt-pilot to TypeScript references

tsconfig.json


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review Bot commented May 1, 2026

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (3)

Grey Divider


Action required

1. Same-package imports include .js 📘 Rule violation ✧ Quality
Description
Multiple internal imports in @abapify/adt-pilot include file extensions (e.g., ./agent.js,
../src/index.js). This violates the rule requiring extensionless imports for same-package modules
and can cause inconsistent import style across the repo.
Code

packages/adt-pilot/src/index.ts[R64-95]

+export type {
+  ConnectionParams,
+  AtcFinding,
+  AtcStepResult,
+  CodeReviewMode,
+  CodeReviewReport,
+  McpToolCaller,
+} from './types.js';
+
+// Workflow
+export {
+  createCodeReviewWorkflow,
+  codeReviewInputSchema,
+  codeReviewOutputSchema,
+} from './workflow.js';
+export type {
+  CodeReviewInput,
+  CodeReviewWorkflow,
+  CodeReviewRun,
+  CodeReviewRunResult,
+} from './workflow.js';
+
+// MCP client factory
+export { createMcpToolCaller, connectMcpClient } from './mcp-client.js';
+
+// Agent
+export { createReviewAgent, REVIEW_AGENT_INSTRUCTIONS } from './agent.js';
+export type { ReviewAgentConfig } from './agent.js';
+
+// Harness
+export { createAbapifyPilot } from './harness.js';
+export type { AbapifyPilotConfig } from './harness.js';
Evidence
PR Compliance ID 116709 forbids file extensions in same-package imports. The new package uses .js
extensions for internal relative imports in source and test files.

Rule 116709: Disallow file extensions in same-package imports
packages/adt-pilot/src/index.ts[64-95]
packages/adt-pilot/src/harness.ts[19-22]
packages/adt-pilot/tests/workflow.test.ts[23-25]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Same-package relative imports include file extensions like `.js` (e.g., `./agent.js`, `../src/index.js`), which violates the repo rule for internal imports.

## Issue Context
This package is TypeScript/ESM, but the compliance requirement still mandates extensionless same-package imports.

## Fix Focus Areas
- packages/adt-pilot/src/index.ts[64-95]
- packages/adt-pilot/src/harness.ts[19-22]
- packages/adt-pilot/tests/workflow.test.ts[23-25]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Local deps not workspace:* 📘 Rule violation ✧ Quality
Description
packages/adt-pilot/package.json declares local workspace packages with a plain version (0.3.6)
instead of a workspace:* protocol. This violates the monorepo dependency versioning requirement
and can break workspace resolution consistency.
Code

packages/adt-pilot/package.json[R28-37]

+  "dependencies": {
+    "@mastra/core": "^1.28.0",
+    "@mastra/mcp": "^1.5.2",
+    "@modelcontextprotocol/sdk": "^1.27.0",
+    "zod": "^3.24.0"
+  },
+  "devDependencies": {
+    "@abapify/adt-fixtures": "0.3.6",
+    "@abapify/adt-mcp": "0.3.6"
+  },
Evidence
PR Compliance ID 122028 requires local workspace dependencies to use the workspace: protocol. The
new adt-pilot package uses plain semver strings for local @abapify/* packages in
devDependencies.

Rule 122028: Use workspace:* protocol for local workspace dependencies in package.json
packages/adt-pilot/package.json[34-37]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Local monorepo dependencies are declared with plain versions instead of the required `workspace:` protocol.

## Issue Context
`@abapify/adt-fixtures` and `@abapify/adt-mcp` are local packages in this repo; the compliance rule requires `workspace:*` (or `workspace:^`/`workspace:~`) for such dependencies.

## Fix Focus Areas
- packages/adt-pilot/package.json[34-37]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Missing published typings 🐞 Bug ≡ Correctness
Description
@abapify/adt-pilot disables DTS generation and its package.json does not expose any types, so
TypeScript consumers will have no typings for the published package.
Code

packages/adt-pilot/tsdown.config.ts[R10-14]

+  // @mastra/core has extremely complex generics + Zod schemas cannot be annotated
+  // for isolatedDeclarations. DTS generation is disabled to avoid OOM (same
+  // pattern as adt-mcp typecheck). TypeScript users can reference the source
+  // directly via moduleResolution:bundler.
+  dts: false,
Evidence
The build config explicitly turns off declaration output, while the package only publishes dist/
and provides no types entry; this contradicts the repo’s own spec for this package and how other
packages are published.

packages/adt-pilot/tsdown.config.ts[10-15]
packages/adt-pilot/package.json[10-17]
openspec/changes/add-abapify-pilot/specs/abapify-pilot-agent/spec.md[35-43]
packages/adt-atc/package.json[9-16]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`packages/adt-pilot/tsdown.config.ts` sets `dts: false`, and `packages/adt-pilot/package.json` does not expose any types. As a result, consumers installing `@abapify/adt-pilot` from npm will not get TypeScript typings.

## Issue Context
The comment says consumers can “reference the source directly”, but the package publishes only `dist/` and `README.md`, so `src/` won’t be available to downstream users.

## Fix Focus Areas
- packages/adt-pilot/tsdown.config.ts[10-15]
- packages/adt-pilot/package.json[10-17]

## What to change
- Re-enable DTS generation (preferred) and add a `types` entry (and/or `exports` types condition) pointing to `./dist/index.d.mts`.
- If DTS truly must remain disabled, then publish `src/` and change `exports` accordingly (but note this changes the consumer contract).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

4. tsdown missing skipNodeModulesBundle 📘 Rule violation ☼ Reliability
Description
packages/adt-pilot/tsdown.config.ts does not explicitly set skipNodeModulesBundle: true in its
exported config. This violates the requirement to enforce externalizing node_modules in tsdown
builds for affected packages.
Code

packages/adt-pilot/tsdown.config.ts[R4-15]

+export default defineConfig({
+  ...baseConfig,
+  entry: {
+    index: 'src/index.ts',
+  },
+  tsconfig: 'tsconfig.lib.json',
+  // @mastra/core has extremely complex generics + Zod schemas cannot be annotated
+  // for isolatedDeclarations. DTS generation is disabled to avoid OOM (same
+  // pattern as adt-mcp typecheck). TypeScript users can reference the source
+  // directly via moduleResolution:bundler.
+  dts: false,
+});
Evidence
PR Compliance ID 116697 requires skipNodeModulesBundle to be explicitly set to true in the
tsdown config used for builds. The new package config does not include that explicit setting.

Rule 116697: Enforce skipNodeModulesBundle=true in tsdown.config.ts
packages/adt-pilot/tsdown.config.ts[4-15]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The package tsdown config does not explicitly set `skipNodeModulesBundle: true` as required.

## Issue Context
Even if a shared/base config currently sets this implicitly, the compliance rule requires an explicit setting in the effective exported config for the package.

## Fix Focus Areas
- packages/adt-pilot/tsdown.config.ts[4-15]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Undeclared test dependency 🐞 Bug ☼ Reliability
Description
packages/adt-pilot/tests/workflow.test.ts imports @abapify/adt-client, but
packages/adt-pilot/package.json does not declare it as a dependency, which can break installs/test
runs under strict package managers.
Code

packages/adt-pilot/tests/workflow.test.ts[R18-23]

+import { Client } from '@modelcontextprotocol/sdk/client/index.js';
+import { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory.js';
+import { createMockAdtServer, type MockAdtServer } from '@abapify/adt-fixtures';
+import { createAdtClient } from '@abapify/adt-client';
+import { createMcpServer } from '@abapify/adt-mcp';
+import { createCodeReviewWorkflow, createMcpToolCaller } from '../src/index.js';
Evidence
The test suite directly imports @abapify/adt-client, but the package’s declared
dependencies/devDependencies omit it.

packages/adt-pilot/tests/workflow.test.ts[18-23]
packages/adt-pilot/package.json[28-37]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The adt-pilot test suite imports `@abapify/adt-client`, but the package does not declare it in `devDependencies`. This can cause test failures with strict dependency enforcement.

## Fix Focus Areas
- packages/adt-pilot/tests/workflow.test.ts[18-23]
- packages/adt-pilot/package.json[28-37]

## What to change
- Add `@abapify/adt-client` to `devDependencies` (workspace version / pinned version consistent with the repo).
- If any runtime code starts importing it later, move it to `dependencies` accordingly.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


6. Misleading category field 🐞 Bug ⚙ Maintainability
Description
extractFindings() assigns AtcFinding.category from ATC’s checkTitle, which contradicts the
public type docs that describe category as a semantic category like PERFORMANCE/SECURITY.
Code

packages/adt-pilot/src/workflow.ts[R455-469]

+      findings.push({
+        objectUri,
+        priority: String(finding.priority ?? 'unknown'),
+        description: String(
+          finding.messageTitle ??
+            finding.checkTitle ??
+            finding.description ??
+            '',
+        ),
+        ...(typeof finding.checkTitle === 'string'
+          ? { category: finding.checkTitle }
+          : {}),
+        ...(typeof finding.checkId === 'string'
+          ? { checkName: finding.checkId }
+          : {}),
Evidence
The type documentation defines category as an ATC check category, but the implementation populates
it with the check’s title. The underlying ATC worklist schema exposes checkTitle and checkId
fields (not a category field), so the current assignment produces misleading output for consumers.

packages/adt-pilot/src/types.ts[29-47]
packages/adt-pilot/src/workflow.ts[455-472]
packages/adt-schemas/src/schemas/generated/types/sap/atcworklist.types.ts[36-48]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The workflow currently sets `AtcFinding.category` to `finding.checkTitle`. This conflicts with the documented meaning of `category` and will mislead consumers that depend on `category` for grouping.

## Fix Focus Areas
- packages/adt-pilot/src/types.ts[29-47]
- packages/adt-pilot/src/workflow.ts[455-472]

## What to change
Pick one consistent contract and implement it:
- Option A (minimal behavioral change): rename `category` to something like `checkTitle` in `AtcFinding`, and adjust the extraction accordingly.
- Option B (keep current public type): populate `checkName` with `checkTitle`, keep `checkId` in a new field (or `checkName`), and only set `category` when you can derive a real category (e.g., from tags/type or omit it). Update docs/tests to match.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

devin-ai-integration[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Nx package @abapify/adt-pilot that provides ABAP ATC-based code review via Mastra in two forms: a deterministic 3-step workflow and an interactive Harness/Agent wrapper, plus OpenSpec documentation and lockfile updates.

Changes:

  • Introduces packages/adt-pilot with Mastra workflow (resolveObjects → runAtcChecks → buildReport), MCP client wrapper, Harness/Agent factories, and Zod schemas.
  • Adds a full Vitest suite for workflow, types/schemas, harness smoke tests, and MCP tool-caller behavior.
  • Registers the new package in workspace TS project references and updates OpenSpec docs + bun.lock.

Reviewed changes

Copilot reviewed 23 out of 25 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tsconfig.json Adds TS project reference for the new adt-pilot package.
packages/adt-pilot/vitest.config.ts Vitest config for the new package.
packages/adt-pilot/tsdown.config.ts Package build configuration (notably disables DTS generation).
packages/adt-pilot/tsconfig.spec.json Test TS config for Vitest typing.
packages/adt-pilot/tsconfig.lib.json Library TS config + references to other workspace packages.
packages/adt-pilot/tsconfig.json Project reference umbrella config.
packages/adt-pilot/tests/workflow.test.ts End-to-end workflow integration tests with in-memory MCP transport.
packages/adt-pilot/tests/types.test.ts Zod schema validation tests for input/output.
packages/adt-pilot/tests/mcp-client.test.ts Unit tests for MCP tool-caller wrapper behavior.
packages/adt-pilot/tests/harness.test.ts Smoke tests for Harness/Agent factories and defaults.
packages/adt-pilot/src/workflow.ts Core workflow implementation + schemas + type-erased Mastra integration.
packages/adt-pilot/src/types.ts Public/shared types for workflow and agent usage.
packages/adt-pilot/src/mcp-client.ts MCP SDK client wrapper + connect helper.
packages/adt-pilot/src/index.ts Public barrel exports for workflow, schemas, types, agent, harness, MCP helpers.
packages/adt-pilot/src/harness.ts Mastra Harness factory with review mode.
packages/adt-pilot/src/agent.ts Mastra Agent factory + default instructions.
packages/adt-pilot/project.json Nx project config with custom typecheck command.
packages/adt-pilot/package.json New publishable package manifest + dependencies.
openspec/changes/add-abapify-pilot/tasks.md Implementation task checklist for the change.
openspec/changes/add-abapify-pilot/specs/code-review-workflow/spec.md Workflow requirements/specification.
openspec/changes/add-abapify-pilot/specs/abapify-pilot-agent/spec.md Harness/agent requirements/specification.
openspec/changes/add-abapify-pilot/proposal.md High-level proposal and rationale.
openspec/changes/add-abapify-pilot/design.md Design decisions and trade-offs.
openspec/changes/add-abapify-pilot/.openspec.yaml OpenSpec metadata.
bun.lock Lockfile updates including new package and Mastra dependency graph.

Comment on lines +9 to +17
"type": "module",
"exports": {
".": "./dist/index.mjs",
"./package.json": "./package.json"
},
"files": [
"dist",
"README.md"
],
Comment on lines +10 to +13
// @mastra/core has extremely complex generics + Zod schemas cannot be annotated
// for isolatedDeclarations. DTS generation is disabled to avoid OOM (same
// pattern as adt-mcp typecheck). TypeScript users can reference the source
// directly via moduleResolution:bundler.
Comment on lines +5 to +6
The `@abapify/adt-pilot` package SHALL export a `createAbapifyPilot(config)` factory that returns a configured Mastra `Harness` instance with the **review** mode wired to the `codeReviewWorkflow`.

Comment on lines +39 to +43
#### Scenario: Build succeeds

- **WHEN** `bunx nx build adt-pilot` is run
- **THEN** the build exits 0 and `packages/adt-pilot/dist/` is populated with `.mjs` and `.d.mts` files

Comment on lines +30 to +33
- **WHEN** the workflow is executed with `mode: 'transport'` and a valid `transportNumber`
- **THEN** the `resolveObjects` step calls the `cts_get_transport` MCP tool with that transport number
- **THEN** the step result contains the list of ABAP object URIs from that transport

@kilo-code-bot
Copy link
Copy Markdown

kilo-code-bot Bot commented May 1, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (25 files)
  • packages/adt-pilot/src/workflow.ts — Deterministic 3-step workflow (resolveObjects → runAtcChecks → buildReport), type-erased Mastra factories, package/transport modes, per-object error capture
  • packages/adt-pilot/src/agent.ts — Mastra review agent with MCP tool integration
  • packages/adt-pilot/src/mcp-client.ts — MCP tool caller wrapping Model Context Protocol SDK
  • packages/adt-pilot/src/harness.ts — Harness factory with 'review' mode
  • packages/adt-pilot/src/types.ts — Public type exports (CodeReviewReport, AtcFinding, McpToolCaller, etc.)
  • packages/adt-pilot/src/index.ts — Public API facade
  • packages/adt-pilot/tests/workflow.test.ts — 9 integration tests (package/transport modes, error handling, empty package)
  • packages/adt-pilot/tests/types.test.ts — 9 schema validation tests (credentials via randomBytes)
  • packages/adt-pilot/tests/harness.test.ts — 5 harness factory smoke tests
  • packages/adt-pilot/tests/mcp-client.test.ts — 5 MCP client tests
  • packages/adt-pilot/package.json, project.json, tsconfig*.json, tsdown.config.ts, vitest.config.ts — Build/test configuration
  • openspec/changes/add-abapify-pilot/ — Design documentation
  • bun.lock — Dependency version sync (workspace:* → 0.3.6)

Incremental Changes (f724665 → HEAD)

Since the last review, only two trivial changes were made:

  1. Extensionless imports — Relative .js extensions removed from all import statements (TypeScript best practice for bundlers/tsdown compatibility)
  2. Doc updates — Example URLs updated from http:// to https://

No code logic, types, or tests were modified. All 12 previously noted inline comments remain on unchanged lines.

Key Highlights

  • New package @abapify/adt-pilot: Mastra-powered ABAP code review with two modes
    • Workflow mode — deterministic, LLM-free 3-step pipeline for package/transport ATC review
    • Harness mode — interactive LLM agent with MCP tools
  • Type hygiene — Mastra deeply generic types erased at import boundary to prevent tsc OOM and DTS bloat
  • Security — All test credentials generated per-process via randomBytes (no hardcoded secrets)
  • Dependency hygiene@abapify/adt-mcp moved to devDeps, @modelcontextprotocol/sdk promoted to runtime
  • Error handling — per-object ATC failures captured as priority: 'error' findings (no workflow abort)
  • Tests — 28 tests passing, 100% success rate

Verification

  • nx typecheck packages/adt-pilot — passed
  • nx test packages/adt-pilot — 28 tests passed
  • ✅ Build cache valid for all 26 dependent tasks

Recommendation

Ready to merge. The implementation is complete, type-safe, well-tested, and follows monorepo best practices.


Reviewed by ling-2.6-1t-20260423:free · 632,024 tokens

Comment thread packages/adt-pilot/src/index.ts Outdated
Comment on lines +64 to +95
export type {
ConnectionParams,
AtcFinding,
AtcStepResult,
CodeReviewMode,
CodeReviewReport,
McpToolCaller,
} from './types.js';

// Workflow
export {
createCodeReviewWorkflow,
codeReviewInputSchema,
codeReviewOutputSchema,
} from './workflow.js';
export type {
CodeReviewInput,
CodeReviewWorkflow,
CodeReviewRun,
CodeReviewRunResult,
} from './workflow.js';

// MCP client factory
export { createMcpToolCaller, connectMcpClient } from './mcp-client.js';

// Agent
export { createReviewAgent, REVIEW_AGENT_INSTRUCTIONS } from './agent.js';
export type { ReviewAgentConfig } from './agent.js';

// Harness
export { createAbapifyPilot } from './harness.js';
export type { AbapifyPilotConfig } from './harness.js';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. Same-package imports include .js 📘 Rule violation ✧ Quality

Multiple internal imports in @abapify/adt-pilot include file extensions (e.g., ./agent.js,
../src/index.js). This violates the rule requiring extensionless imports for same-package modules
and can cause inconsistent import style across the repo.
Agent Prompt
## Issue description
Same-package relative imports include file extensions like `.js` (e.g., `./agent.js`, `../src/index.js`), which violates the repo rule for internal imports.

## Issue Context
This package is TypeScript/ESM, but the compliance requirement still mandates extensionless same-package imports.

## Fix Focus Areas
- packages/adt-pilot/src/index.ts[64-95]
- packages/adt-pilot/src/harness.ts[19-22]
- packages/adt-pilot/tests/workflow.test.ts[23-25]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +28 to +37
"dependencies": {
"@mastra/core": "^1.28.0",
"@mastra/mcp": "^1.5.2",
"@modelcontextprotocol/sdk": "^1.27.0",
"zod": "^3.24.0"
},
"devDependencies": {
"@abapify/adt-fixtures": "0.3.6",
"@abapify/adt-mcp": "0.3.6"
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

2. Local deps not workspace:* 📘 Rule violation ✧ Quality

packages/adt-pilot/package.json declares local workspace packages with a plain version (0.3.6)
instead of a workspace:* protocol. This violates the monorepo dependency versioning requirement
and can break workspace resolution consistency.
Agent Prompt
## Issue description
Local monorepo dependencies are declared with plain versions instead of the required `workspace:` protocol.

## Issue Context
`@abapify/adt-fixtures` and `@abapify/adt-mcp` are local packages in this repo; the compliance rule requires `workspace:*` (or `workspace:^`/`workspace:~`) for such dependencies.

## Fix Focus Areas
- packages/adt-pilot/package.json[34-37]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +10 to +14
// @mastra/core has extremely complex generics + Zod schemas cannot be annotated
// for isolatedDeclarations. DTS generation is disabled to avoid OOM (same
// pattern as adt-mcp typecheck). TypeScript users can reference the source
// directly via moduleResolution:bundler.
dts: false,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

3. Missing published typings 🐞 Bug ≡ Correctness

@abapify/adt-pilot disables DTS generation and its package.json does not expose any types, so
TypeScript consumers will have no typings for the published package.
Agent Prompt
## Issue description
`packages/adt-pilot/tsdown.config.ts` sets `dts: false`, and `packages/adt-pilot/package.json` does not expose any types. As a result, consumers installing `@abapify/adt-pilot` from npm will not get TypeScript typings.

## Issue Context
The comment says consumers can “reference the source directly”, but the package publishes only `dist/` and `README.md`, so `src/` won’t be available to downstream users.

## Fix Focus Areas
- packages/adt-pilot/tsdown.config.ts[10-15]
- packages/adt-pilot/package.json[10-17]

## What to change
- Re-enable DTS generation (preferred) and add a `types` entry (and/or `exports` types condition) pointing to `./dist/index.d.mts`.
- If DTS truly must remain disabled, then publish `src/` and change `exports` accordingly (but note this changes the consumer contract).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

…s rule

Removes .js extensions from all internal relative imports in adt-pilot
src and tests to comply with the mandatory bundler-imports rule (since
tsconfig.base.json uses moduleResolution: bundler). Matches the
convention used in every other package in the monorepo.

Addresses Devin Review findings:
- BUG_pr-review-job-f33d242b3be645e096ee9c409f2ad9e4_0001 (src/index.ts)
- BUG_pr-review-job-f33d242b3be645e096ee9c409f2ad9e4_0002 (src/workflow.ts)
- BUG_pr-review-job-f33d242b3be645e096ee9c409f2ad9e4_0003 (src/mcp-client.ts)
- BUG_pr-review-job-f33d242b3be645e096ee9c409f2ad9e4_0004 (src/harness.ts)

Co-Authored-By: Petr Plenkov <petr.plenkov@gmail.com>
devin-ai-integration[bot]

This comment was marked as resolved.

- Add `@abapify/adt-client` as a devDependency. Tests import
  `createAdtClient` from it (tests/workflow.test.ts), and the project
  reference list in tsconfig.lib.json already points at it. Without an
  explicit declaration the package was only resolvable via bun
  workspace hoisting, which fails in stricter resolvers.
- Drop `@mastra/mcp` from runtime dependencies. No source file under
  `src/` imports it; all Mastra surfaces in use are from
  `@mastra/core/*`, and all MCP transport code is built on
  `@modelcontextprotocol/sdk`. JSDoc comments referencing
  `@mastra/mcp` describe an optional consumer choice for sourcing
  `mcpTools` and remain accurate.

Addresses Devin Review findings:
- BUG_pr-review-job-5092d9235b51447997e11b8d8766108a_0001
  (missing @abapify/adt-client devDep)
- BUG_pr-review-job-5092d9235b51447997e11b8d8766108a_0002
  (phantom @mastra/mcp runtime dep)

Co-Authored-By: Petr Plenkov <petr.plenkov@gmail.com>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 1, 2026

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.

3 participants