Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b8959e0
chore: initialize feature branch
MagPasulke May 30, 2026
7cfe7c5
feat(adt-gitpull): add branch parameter with auto-detect from current…
MagPasulke May 30, 2026
123bbd0
docs: add session summary for PR-65
MagPasulke May 30, 2026
0fbe372
fix(adt-gitpull): use tool.schema.string() for branch arg definition
MagPasulke May 30, 2026
5187d82
build: add typescript typecheck to test pipeline
MagPasulke May 30, 2026
9aa5796
chore: remove unused jest dependency
MagPasulke May 30, 2026
75a2635
docs: update AGENTS.md to reflect unified npm test command
MagPasulke May 30, 2026
416bb7c
docs: update ABAP Unit test instructions to use adt_* tools
MagPasulke May 30, 2026
68eaadb
docs: clarify adt_* tools require user trigger
MagPasulke May 30, 2026
ec5ca31
docs: fix ABAP Unit test sequence (commit+push before SAP sync)
MagPasulke May 30, 2026
66fb9c8
docs: add SAP sync as explicit step 9 in implementation workflow
MagPasulke May 30, 2026
3f43233
docs: fix sequence in ABAP Unit test note (test before commit)
MagPasulke May 30, 2026
a07980c
test: temporary version bump to verify SAP sync
MagPasulke May 30, 2026
e3a0f08
revert: remove temporary version bump
MagPasulke May 30, 2026
3fdd391
test: add dummy constant to verify SAP sync
MagPasulke May 30, 2026
b8f1c1b
test: add second dummy constant for SAP sync verification
MagPasulke May 30, 2026
ec6955c
fix(adt-gitpull): switch SAP repo branch before pulling
MagPasulke May 30, 2026
5b830ff
test: add third dummy constant for SAP sync verification
MagPasulke May 30, 2026
e533031
revert: remove all dummy constants from version interface
MagPasulke May 30, 2026
96f4ca5
docs: add chat-mode-only and switchRepoBranch notes to adt_* skills
MagPasulke May 30, 2026
1a2d05b
docs: update session summary with full scope of changes
MagPasulke May 30, 2026
30a185a
docs: remove overly restrictive chat-mode-only note from adt_rununit …
MagPasulke May 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions .agents/skills/adt-gitpull/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,40 @@ description: Trigger an abapGit repository pull on the SAP system to sync the cu

## Tool

Use the built-in `adt_gitpull` custom tool. It requires **no parameters**.
Use the built-in `adt_gitpull` custom tool.

### Parameters

| Parameter | Required | Description |
|-----------|----------|-------------|
| `branch` | No | Branch to pull (short name like `main` or full ref like `refs/heads/feat/my-feature`). If omitted, auto-detects from the currently checked-out git branch. |

## What it does

1. Reads SAP credentials from `.env` in the project root (`SAP_ADT_URL`, `SAP_ADT_USER`, `SAP_ADT_PASSWORD`)
2. Determines the git remote URL (`origin`)
3. Connects to the SAP system via ADT API
4. Lists all abapGit repositories linked in the system
5. Finds the one matching the local remote URL
6. Triggers a pull (imports current branch state into the SAP system)
3. Resolves the branch to pull — uses the explicit `branch` parameter if provided, otherwise detects from `git rev-parse --abbrev-ref HEAD`
4. Connects to the SAP system via ADT API
5. Lists all abapGit repositories linked in the system
6. Finds the one matching the local remote URL
7. Switches the SAP repo to the target branch (via `switchRepoBranch`) if it differs from the currently configured branch
8. Pulls the resolved branch (always passes explicit `refs/heads/<branch>` to the API)

## When to use

Only when the user explicitly requests a sync to SAP. Typical scenarios:
- After merging a PR into `main`, user says "sync to SAP" or "pull to SAP"
- User wants to test a feature branch on the SAP system before merging
- User wants to verify ABAP Unit tests on the system after pushing changes

**Never call autonomously.** Always wait for user trigger.

## Important: Chat mode only

This tool (and `adt_rununit`) must **only be used in interactive chat mode** — never in autonomous/background agent runs. When using in chat mode:
- Always wait for user confirmation before calling
- After calling, wait for the user to confirm the result on the SAP side before proceeding with further steps

## Prerequisites

- `.env` in project root with valid credentials (see `.env.example`):
Expand Down
15 changes: 12 additions & 3 deletions .opencode/tools/adt_gitpull.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { tool } from "@opencode-ai/plugin"

Check failure on line 1 in .opencode/tools/adt_gitpull.ts

View workflow job for this annotation

GitHub Actions / lint-and-test

Cannot find module '@opencode-ai/plugin' or its corresponding type declarations.
import { readFileSync } from "node:fs"
import { resolve } from "node:path"
import { adtGitPull } from "../../scripts/adt_gitpull_core"
Expand Down Expand Up @@ -26,9 +26,17 @@
description:
"Triggers an abapGit pull on the SAP system for this repository. " +
"Automatically finds the repo by matching the git remote URL. " +
"No parameters needed — uses credentials from .env (SAP_ADT_URL, SAP_ADT_USER, SAP_ADT_PASSWORD).",
args: {},
async execute(_args, context) {
"Uses credentials from .env (SAP_ADT_URL, SAP_ADT_USER, SAP_ADT_PASSWORD). " +
"If branch is omitted, auto-detects from the current git checkout.",
args: {
branch: tool.schema.string()
.describe(
"Branch to pull (short name like 'main' or full ref like 'refs/heads/feat/my-feature'). " +
"If omitted, auto-detects from the currently checked-out branch."
)
.optional(),
},
async execute(args, context) {

Check failure on line 39 in .opencode/tools/adt_gitpull.ts

View workflow job for this annotation

GitHub Actions / lint-and-test

Parameter 'context' implicitly has an 'any' type.

Check failure on line 39 in .opencode/tools/adt_gitpull.ts

View workflow job for this annotation

GitHub Actions / lint-and-test

Parameter 'args' implicitly has an 'any' type.
const rootDir = context.worktree || context.directory
const env = loadEnv(rootDir)
const url = process.env.SAP_ADT_URL || env.SAP_ADT_URL
Expand All @@ -49,6 +57,7 @@
user,
password,
cwd: rootDir,
branch: args.branch,
})

if (!result.ok) {
Expand Down
16 changes: 9 additions & 7 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ Only enter this workflow when the user signals intent to **implement something**
4. **Open draft PR** against `main`
5. **Implement** the changes
6. **Write/enhance tests** — Use the **`create-tests`** skill for guidance on which test layer(s) to update and how
7. **Run `npm run lint && npm test`**
7. **Run `npm test`**
- If pass → commit & push
- If fail → attempt one fix cycle; if still failing, report errors to user and wait for guidance
8. **Repeat steps 5–7** for each logical unit of work (multiple commits are encouraged for traceability)
9. **Create session summary** as the final commit (using `session-summary` skill)
10. **Mark PR ready for review**
9. **Ask user whether to sync to SAP and run ABAP Unit tests** — use `adt_gitpull` + `adt_rununit`. Never run without explicit user confirmation.
10. **Create session summary** as the final commit (using `session-summary` skill)
11. **Mark PR ready for review**
- PR description includes: "⚠️ Please sync to SAP system via abapGit and run ABAP Unit tests before merging."

This applies to ALL changes — code, documentation, skills, configuration. No exceptions.
Expand All @@ -52,7 +53,7 @@ This applies to ALL changes — code, documentation, skills, configuration. No e
- **Always use the `conventional-commit` skill** for every commit
- **Never amend commits** — each change gets its own commit
- **Never force-push** (`--force`, `--force-with-lease`) — history must remain linear and traceable
- **Only commit when tests pass** — never push code that fails `npm run lint && npm test`
- **Only commit when tests pass** — never push code that fails `npm test`
- If a fix is needed after a commit, create a new commit with a clear message (e.g., `fix: resolve duplicate attribute in zasis_cx_exc`)
- The commit history should tell the story of what happened, including fixes

Expand Down Expand Up @@ -168,8 +169,9 @@ The project has three test layers, each covering different concerns. For a full
| Script | Command | Description |
|--------|---------|-------------|
| `npm run lint` | `abaplint` | Static analysis using abaplint (rules in `abaplint.json`) |
| `npm run typecheck` | `tsc --noEmit` | TypeScript type-checking for scripts/*.ts and .opencode/tools/*.ts |
| `npm run unit` | Transpile + run in Node.js | Transpiles ABAP to JS via `abap_transpile.json` and runs unit tests |
| `npm test` | `lint` + `unit` | Runs both lint and transpiled unit tests |
| `npm test` | `lint` + `typecheck` + `unit` | Runs all three checks |
| `npm run icf-test` | `node --test` | ICF shim integration tests — full HTTP handler stack without SAP |
| `npm run icf-server` | Express server | Starts standalone server on port 3040 for manual curl testing |
| `npm run sap-test` | `node --test` | Same shared scenarios against real SAP system |
Expand All @@ -185,8 +187,8 @@ The project has three test layers, each covering different concerns. For a full

### Important Testing Notes

- **Local validation before commit**: Always run `npm run lint && npm test` (step 7 in workflow). Also run `npm run icf-test` when HTTP handler or factory logic is modified.
- **ABAP Unit Tests**: The authoritative test suite runs on the SAP system itself. **After making changes, always ask the user to sync the project to the ABAP system via abapGit, run the ABAP Unit tests there, and confirm the results before considering the change complete.**
- **Local validation before commit**: Always run `npm test` (step 7 in workflow). Also run `npm run icf-test` when HTTP handler or factory logic is modified.
- **ABAP Unit Tests**: The authoritative test suite runs on the SAP system itself. **After local `npm test` passes, changes are committed and pushed, ask the user whether to sync the branch to SAP and run ABAP Unit tests (step 9 in workflow, via `adt_gitpull` + `adt_rununit`). Never run without explicit user confirmation.**
- **When to write which tests**: Use the **`create-tests`** skill for detailed guidance on where to add/adapt tests for different kinds of changes.


Expand Down
8 changes: 8 additions & 0 deletions docs/sessions/2026-05-30_PR-65_gitpull-branch-support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# 2026-05-30 PR-65 gitpull-branch-support

**Date:** 2026-05-30
**Title:** Enhance adt_gitpull to support pulling from different branches

## Summary

Implemented issue #63 by adding an optional `branch` parameter to the `adtGitPull` core function, OpenCode tool wrapper, and skill documentation. When provided, the branch is passed directly to the SAP API in full ref format (`refs/heads/<name>`); when omitted, it auto-detects from the currently checked-out git branch via `git rev-parse --abbrev-ref HEAD`. Discovered during testing that `gitPullRepo` alone does not switch the SAP-side branch — added `switchRepoBranch` call before pull to fix this. Also added `typescript` as devDependency with a `typecheck` npm script (included in `npm test`), removed unused `jest` dependency (290 packages), updated AGENTS.md to use unified `npm test` command everywhere, and added chat-mode-only usage notes to both adt_* skill docs. Verified end-to-end: feature branch synced to SAP, dummy constants appeared, cleanup confirmed, 51/51 ABAP Unit tests pass. PR #65 against `main`.
Loading
Loading