Skip to content

chore: add /cap-build-process Claude slash command#102

Open
Kronprinz03 wants to merge 1 commit intomainfrom
adding-new-claude-command-for-plugin-user
Open

chore: add /cap-build-process Claude slash command#102
Kronprinz03 wants to merge 1 commit intomainfrom
adding-new-claude-command-for-plugin-user

Conversation

@Kronprinz03
Copy link
Copy Markdown
Contributor

@Kronprinz03 Kronprinz03 commented May 5, 2026

Summary

  • Adds .claude/commands/cap-build-process.md — a Claude Code slash command available to anyone working in this repo
  • Gives users expert guidance on setup, annotations, build errors, runtime errors, and credential troubleshooting
  • Is able to do the annotations and validate them with the build plugin
  • Includes an autonomous procedure for checking deployed SBPA processes: resolves hybrid binding credentials automatically (via cds env get.cdsrc-private.jsoncf service-key), fetches a token, calls the SBPA API, and cross-references remote processes against locally imported ones

Test plan

  • Open Claude Code in a CAP project that has @cap-js/process installed
  • Run /cap-build-process and verify the command loads
  • Ask "show me deployed processes" and verify Claude resolves credentials and calls the API without prompting for input

Adds a Claude Code slash command at .claude/commands/cap-build-process.md
that gives users expert guidance on setup, annotations, errors, and
autonomously checks deployed SBPA processes via the hybrid binding.
@hyperspace-insights
Copy link
Copy Markdown
Contributor

Summary

The following content is AI-generated and provides a summary of the pull request:


Add Claude Slash Command for @cap-js/process Debug & How-To Assistance

New Feature

✨ Adds a new Claude Code slash command /cap-build-process to assist developers working with the @cap-js/process plugin for SAP Build Process Automation (SBPA) integration in CAP applications.

Changes

  • .claude/commands/cap-build-process.md: New Claude Code slash command that provides expert guidance on:
    • Setup & Installation: Configuration for local development and hybrid/production environments
    • Process Import: Commands for importing process definitions from files or directly from SBPA
    • Annotation Syntax: Declarative approach for starting, cancelling, suspending, and resuming workflows
    • Programmatic API: Usage examples for both typed and generic ProcessService
    • Build-Time Errors & Warnings: Reference table of common build errors with fixes
    • Runtime Errors: Troubleshooting guide for runtime failures
    • Credentials Troubleshooting: How to verify and re-bind SBPA service credentials
    • Autonomous Deployed Process Check: A self-contained 5-step procedure that resolves hybrid binding credentials (via cds env get.cdsrc-private.jsoncf service-key), fetches an OAuth token, queries the SBPA API, and cross-references remote workflows against locally imported ones — all without prompting the user for credentials
    • Debugging Tips: How to trace stuck or missing process instances using business keys and instance queries

  • 🔄 Regenerate and Update Summary
  • ✏️ Insert as PR Description (deletes this comment)
  • 🗑️ Delete comment
PR Bot Information

Version: 1.20.37

  • Summary Prompt: Default Prompt
  • Event Trigger: pull_request.opened
  • LLM: anthropic--claude-4.6-sonnet
  • File Content Strategy: Full file content
  • Output Template: Default Template
  • Correlation ID: dbc166bc-3405-403f-8906-90b046a10d7e

Copy link
Copy Markdown
Contributor

@hyperspace-insights hyperspace-insights Bot left a comment

Choose a reason for hiding this comment

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

The PR adds a useful Claude slash command for @cap-js/process, but contains several correctness issues: the generic ProcessService code examples use the wrong event dispatch method (send instead of emit for lifecycle events) and include an incorrect businessKey field in the start payload, the typed service start signature needs verification against the actual generated API, and the grep pattern for finding local process IDs would silently produce empty results — breaking the cross-reference table in Step 5.

PR Bot Information

Version: 1.20.37

  • File Content Strategy: Full file content
  • Correlation ID: dbc166bc-3405-403f-8906-90b046a10d7e
  • Event Trigger: pull_request.opened
  • LLM: anthropic--claude-4.6-sonnet

Comment on lines +132 to +136
await svc.emit('start', {
definitionId: 'eu12.myorg.myproject.processId',
context: { orderId: '123' },
businessKey: 'ORDER-123'
})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: start on the generic ProcessService must use emit, but cancel/suspend/resume must also use emit — however the start payload shape is wrong.

Looking at the actual BTPProcessService.cds and BTPProcessService.ts, the start event expects { definitionId, context } — not a top-level businessKey field. The businessKey is passed as a messaging header (third argument to cds.queued(...).emit), not in the payload body. The example shown here incorrectly puts businessKey inside the payload object.

Should be:

await svc.emit('start', {
  definitionId: 'eu12.myorg.myproject.processId',
  context: { orderId: '123' }
})

The businessKey in the outbox header is handled internally by the plugin and is not a user-supplied field in this call.

Suggested change
await svc.emit('start', {
definitionId: 'eu12.myorg.myproject.processId',
context: { orderId: '123' },
businessKey: 'ORDER-123'
})
// Start (async, via outbox)
await svc.emit('start', {
definitionId: 'eu12.myorg.myproject.processId',
context: { orderId: '123' }
})

Double-check suggestion before committing. Edit this comment for amendments.


Please provide feedback on the review comment by checking the appropriate box:

  • 🌟 Awesome comment, a human might have missed that.
  • ✅ Helpful comment
  • 🤷 Neutral
  • ❌ This comment is not helpful

})

// Cancel
await svc.emit('cancel', { businessKey: 'ORDER-123' })
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: cancel, suspend, and resume on the generic ProcessService are events (not actions), so they must also be dispatched with emit, not send. The CDS service definition (BTPProcessService.cds) declares them as event, and the implementation uses cds.queued(processService).emit(...). Calling svc.send('cancel', ...) would attempt a synchronous action invocation and fail at runtime.

Consider changing all three lifecycle operations to use emit:

await svc.emit('cancel', { businessKey: 'ORDER-123' })
await svc.emit('suspend', { businessKey: 'ORDER-123' })
await svc.emit('resume', { businessKey: 'ORDER-123' })
Suggested change
await svc.emit('cancel', { businessKey: 'ORDER-123' })
// Cancel
await svc.emit('cancel', { businessKey: 'ORDER-123' })
// Suspend
await svc.emit('suspend', { businessKey: 'ORDER-123' })
// Resume
await svc.emit('resume', { businessKey: 'ORDER-123' })

Double-check suggestion before committing. Edit this comment for amendments.


Please provide feedback on the review comment by checking the appropriate box:

  • 🌟 Awesome comment, a human might have missed that.
  • ✅ Helpful comment
  • 🤷 Neutral
  • ❌ This comment is not helpful

import { MyProcessService } from '#cds-models/MyProcessService'

const svc = await cds.connect.to(MyProcessService)
await svc.start({ orderId: '123', amount: 500 })
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: The typed service start method signature is wrong. Looking at processService.ts, the typed service's start handler receives req.data.inputs (not top-level named fields). The inputs object is what gets forwarded as context. The call svc.start({ orderId: '123', amount: 500 }) implies flat named parameters are the API, but the actual typed service generated after cds import wraps them under inputs. Verify the generated typed API before documenting this signature — it may need to be svc.start({ inputs: { orderId: '123', amount: 500 } }) or similar, depending on the generated CDS action signature.


Please provide feedback on the review comment by checking the appropriate box:

  • 🌟 Awesome comment, a human might have missed that.
  • ✅ Helpful comment
  • 🤷 Neutral
  • ❌ This comment is not helpful

Comment on lines +235 to +237
```bash
grep -rh "@bpm\.process\s*:" srv/external/*.cds 2>/dev/null
ls srv/workflows/ 2>/dev/null
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Logic Error: The grep pattern is wrong for finding local process IDs. The annotation that carries the process definition ID is @bpm.process.start, @bpm.process.cancel, etc. — not a bare @bpm.process:. The pattern @bpm\.process\s*: would not match any actual annotation and would always return empty results, causing Step 5's cross-reference to show every remote process as ⬇️ not imported.

Consider scanning for the id: field within the annotation blocks, or use a pattern that matches the actual generated content of the .cds files (e.g., the @bpm.process: annotation on the service itself):

grep -rh "bpm\.process" srv/external/*.cds 2>/dev/null
ls srv/workflows/*.json 2>/dev/null | xargs -I{} basename {} .json

Using the workflow JSON filenames from srv/workflows/ is the most reliable source of local process IDs.

Suggested change
```bash
grep -rh "@bpm\.process\s*:" srv/external/*.cds 2>/dev/null
ls srv/workflows/ 2>/dev/null
ls srv/workflows/*.json 2>/dev/null | xargs -I{} basename {} .json

Double-check suggestion before committing. Edit this comment for amendments.


Please provide feedback on the review comment by checking the appropriate box:

  • 🌟 Awesome comment, a human might have missed that.
  • ✅ Helpful comment
  • 🤷 Neutral
  • ❌ This comment is not helpful

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