Skip to content

Commit 5a24462

Browse files
authored
Merge pull request #8 from abap2UI5-addons/claude/repo-audit-review-fr5qem
Repo audit: XLSX MIME fix, CI parity and cleanup
2 parents 15e1f6f + 8c9d018 commit 5a24462

26 files changed

Lines changed: 1221 additions & 79 deletions

.gitattributes

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Normalize line endings to LF for all text files (abapGit + tooling expect LF)
2+
* text=auto eol=lf
3+
*.abap text eol=lf
4+
*.xml text eol=lf
5+
*.json text eol=lf
6+
*.jsonc text eol=lf
7+
*.md text eol=lf
8+
*.mjs text eol=lf
9+
*.js text eol=lf
10+
*.yaml text eol=lf
11+
*.yml text eol=lf

.github/abaplint/abap_cloud.jsonc

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"global": {
3+
"files": "/../../src/**/*.*"
4+
},
5+
"dependencies": [
6+
{
7+
"url": "https://github.com/abapedia/steampunk-2305-api-intersect-702",
8+
"folder": "/deps",
9+
"files": "/src/**/*.*"
10+
},
11+
{
12+
"url": "https://github.com/abap2UI5/abap2UI5",
13+
"folder": "/abap2UI5",
14+
"files": "/src/**/*.*"
15+
},
16+
{
17+
"url": "https://github.com/abap2UI5-addons/popups",
18+
"folder": "/popups",
19+
"files": "/src/**/*.*"
20+
},
21+
{
22+
"url": "https://github.com/abap2xlsx/abap2xlsx",
23+
"folder": "/abap2xlsx",
24+
"files": "/src/**/*.*"
25+
}
26+
],
27+
"syntax": {
28+
"version": "Cloud",
29+
"errorNamespace": "."
30+
},
31+
"rules": {
32+
"downport": true,
33+
"begin_end_names": true,
34+
"check_ddic": true,
35+
"check_include": true,
36+
"check_syntax": true,
37+
"global_class": true,
38+
"definitions_top": false,
39+
"implement_methods": true,
40+
"method_implemented_twice": true,
41+
"parser_error": true,
42+
"superclass_final": true,
43+
"unknown_types": true,
44+
"xml_consistency": true
45+
}
46+
}

.github/abaplint/rename.json

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"global": {
3+
"files": "/../../src/**/*.*"
4+
},
5+
"dependencies": [
6+
{
7+
"url": "https://github.com/abapedia/steampunk-2305-api-intersect-702",
8+
"folder": "/deps",
9+
"files": "/src/**/*.*"
10+
},
11+
{
12+
"url": "https://github.com/abap2UI5/abap2UI5",
13+
"folder": "/abap2UI5",
14+
"files": "/src/**/*.*"
15+
},
16+
{
17+
"url": "https://github.com/abap2UI5-addons/popups",
18+
"folder": "/popups",
19+
"files": "/src/**/*.*"
20+
},
21+
{
22+
"url": "https://github.com/abap2xlsx/abap2xlsx",
23+
"folder": "/abap2xlsx",
24+
"files": "/src/**/*.*"
25+
}
26+
],
27+
"rename": {
28+
"output": "output",
29+
"patterns": [
30+
{
31+
"type": "CLAS|INTF|TABL",
32+
"oldName": "z2ui5_(.*)",
33+
"newName": "zabap2ui5_$1"
34+
}
35+
]
36+
},
37+
"syntax": {
38+
"version": "v750",
39+
"errorNamespace": "."
40+
},
41+
"rules": {
42+
"allowed_object_types": {
43+
"allowed": [
44+
"CLAS",
45+
"DEVC",
46+
"INTF",
47+
"TABL"
48+
]
49+
},
50+
"allowed_object_naming": true,
51+
"begin_end_names": true,
52+
"check_ddic": true,
53+
"check_include": true,
54+
"check_syntax": true,
55+
"global_class": true,
56+
"implement_methods": true,
57+
"method_implemented_twice": true,
58+
"parser_error": true,
59+
"superclass_final": true,
60+
"unknown_types": true,
61+
"xml_consistency": true
62+
}
63+
}

.github/workflows/ABAP_CLOUD.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: ABAP_CLOUD
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: ABAP_CLOUD-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
ABAP_CLOUD:
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 10
19+
steps:
20+
- uses: actions/checkout@v5
21+
- uses: actions/setup-node@v5
22+
with:
23+
node-version: '22'
24+
cache: 'npm'
25+
- run: npm ci
26+
- run: npx abaplint .github/abaplint/abap_cloud.jsonc
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: ABAP_STANDARD
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: ABAP_STANDARD-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
ABAP_STANDARD:
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 10
19+
steps:
20+
- uses: actions/checkout@v5
21+
- uses: actions/setup-node@v5
22+
with:
23+
node-version: '22'
24+
cache: 'npm'
25+
- run: npm ci
26+
- run: npx abaplint ./abaplint.jsonc
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: build_rename
2+
3+
# Renames all artifacts to a chosen namespace and pushes the result to
4+
# the branch rename_<name>, e.g. rename_zmyui5 - ready to pull with
5+
# abapGit for a parallel installation in the same SAP system. The
6+
# renaming itself is the plain abaplint rename with the checked-in
7+
# config .github/abaplint/rename.json (placeholder "zabap2ui5"); this
8+
# workflow only sets the chosen name in the config and stores the
9+
# result. Re-running with the same name updates the branch to the
10+
# current main state; without content changes nothing is pushed. The
11+
# main commit is carried as second parent so GitHub shows the branch as
12+
# "ahead" instead of "behind" main.
13+
14+
on:
15+
workflow_dispatch:
16+
inputs:
17+
namespace:
18+
description: "New namespace (max. 9 characters), e.g. ZMYUI5"
19+
required: true
20+
type: string
21+
default: zabap2ui5
22+
23+
permissions:
24+
contents: write
25+
26+
concurrency:
27+
group: build_rename-${{ inputs.namespace }}
28+
cancel-in-progress: false
29+
30+
jobs:
31+
build_rename:
32+
runs-on: ubuntu-latest
33+
timeout-minutes: 15
34+
env:
35+
NAMESPACE: ${{ inputs.namespace }}
36+
steps:
37+
# validate the input and derive the branch name before building
38+
- name: Derive branch name
39+
run: |
40+
if ! printf '%s' "$NAMESPACE" | grep -Eq '^[A-Za-z][A-Za-z0-9_]{0,8}$'; then
41+
echo "::error::Invalid namespace '$NAMESPACE' (letter + letters/digits/underscore, max. 9 characters)"
42+
exit 1
43+
fi
44+
ns=$(printf '%s' "$NAMESPACE" | tr '[:upper:]' '[:lower:]')
45+
if [ "$ns" = "z2ui5" ]; then
46+
echo "::error::Namespace '$NAMESPACE' is the original namespace - nothing to rename"
47+
exit 1
48+
fi
49+
echo "NS=$ns" >> "$GITHUB_ENV"
50+
echo "BRANCH=rename_$ns" >> "$GITHUB_ENV"
51+
echo "Building branch: rename_$ns"
52+
53+
- uses: actions/checkout@v5
54+
- uses: actions/setup-node@v5
55+
with:
56+
node-version: '22'
57+
cache: 'npm'
58+
- run: npm ci
59+
60+
# set the chosen name in the rename config and run the abaplint
61+
# rename; it writes the renamed sources to
62+
# .github/abaplint/output/<workspace path>/src
63+
- name: Rename to ${{ inputs.namespace }}
64+
run: |
65+
sed "s/zabap2ui5/$NS/g" .github/abaplint/rename.json > .github/abaplint/rename_run.json
66+
npx abaplint .github/abaplint/rename_run.json --rename
67+
68+
# branch content: the renamed src tree plus the abapGit descriptor
69+
# and the license
70+
- name: Assemble branch content
71+
run: |
72+
src=$(find .github/abaplint/output -type d -name src | head -n 1)
73+
if [ -z "$src" ]; then
74+
echo "::error::no renamed src folder found under .github/abaplint/output"
75+
exit 1
76+
fi
77+
out=".github/out/$BRANCH"
78+
rm -rf "$out"
79+
mkdir -p "$out"
80+
cp -r "$src" "$out/src"
81+
cp LICENSE "$out/"
82+
cp .abapgit.xml "$out/"
83+
84+
- name: Push renamed branch
85+
run: |
86+
b="$BRANCH"
87+
git config user.name 'github-actions[bot]'
88+
git config user.email 'github-actions[bot]@users.noreply.github.com'
89+
git fetch origin "$b" --depth 1 2>/dev/null || true
90+
parent=$(git rev-parse -q --verify "refs/remotes/origin/$b" || true)
91+
index="$RUNNER_TEMP/index-$b"
92+
rm -f "$index"
93+
(cd ".github/out/$b" && GIT_DIR="$GITHUB_WORKSPACE/.git" GIT_WORK_TREE=. GIT_INDEX_FILE="$index" git add -A)
94+
tree=$(GIT_INDEX_FILE="$index" git write-tree)
95+
if [ -n "$parent" ] && [ "$(git rev-parse "$parent^{tree}")" = "$tree" ]; then
96+
echo "$b: no changes"
97+
exit 0
98+
fi
99+
commit=$(git commit-tree "$tree" ${parent:+-p "$parent"} -p "$GITHUB_SHA" -m "build: $b from $GITHUB_SHA")
100+
git push origin "$commit:refs/heads/$b"
101+
echo "$b: pushed $commit"

.github/workflows/rename_test.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: renaming
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: rename_test-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
rename_test:
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 10
19+
steps:
20+
- uses: actions/checkout@v5
21+
- uses: actions/setup-node@v5
22+
with:
23+
node-version: '22'
24+
cache: 'npm'
25+
- run: npm ci
26+
- run: npm run rename

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
output
3+
.github/out/
4+
.github/abaplint/output/
5+
.github/abaplint/rename_run.json

AGENTS.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# AGENTS.md — AI Assistant Guide for abap2UI5 table-content-loader
2+
3+
> This file follows the cross-tool AGENTS.md convention and is the single
4+
> agent instruction file of this repository — Claude Code reads `AGENTS.md`
5+
> natively, there is no separate `CLAUDE.md`.
6+
7+
## Project Overview
8+
9+
Upload, edit and download table content (JSON, CSV, XLSX) for
10+
[abap2UI5](https://github.com/abap2UI5/abap2UI5) (`z2ui5_cl_tcl_*`).
11+
12+
**Language:** English — all code, comments, commit messages, PRs, issues and
13+
documentation must be in English.
14+
15+
## Package Structure
16+
17+
| Package | Content |
18+
|---|---|
19+
| `src/` | App classes `z2ui5_cl_tcl_app_00``_06` |
20+
| `src/01/z2ui5_cl_tcl_xlsx_api` | XLSX helper |
21+
| `src/z2ui5_cl_tcl_context` | Vendored utility copy — **see below** |
22+
23+
## The Utility Copy Principle
24+
25+
`z2ui5_cl_tcl_context` is a **trimmed, renamed copy** of the abap2UI5 utility
26+
class (`z2ui5_cl_util` in the core), carrying only the methods this addon uses
27+
(conv/itab/json/xml/rtti helpers) plus the private helpers and char constants
28+
those need. The app calls `z2ui5_cl_tcl_context=>…`, never `z2ui5_cl_util=>…`
29+
directly. This keeps the install dependency-free (abapGit has no dependency
30+
management). The core and the other addons use the same pattern. When a new
31+
utility method is needed, copy it from the core utility class (with its private
32+
helpers) into the context copy rather than adding a dependency.
33+
34+
## Dependencies
35+
36+
Installed alongside via abapGit; declared in the abaplint configs:
37+
38+
* [abap2UI5](https://github.com/abap2UI5/abap2UI5)
39+
* [popups](https://github.com/abap2UI5-addons/popups)
40+
* [abap2xlsx](https://github.com/abap2xlsx/abap2xlsx)
41+
42+
## Security
43+
44+
This is a developer tool. It reads from and writes to any table the user names,
45+
without an authorization check of its own (the Z/Y namespace hint on write is
46+
only a warning, not enforced). Before using it beyond a development system, add
47+
your own `AUTHORITY-CHECK`s and restrict who may run the app.
48+
49+
## Coding Style
50+
51+
Follows the abap2UI5 core conventions (see its
52+
[AGENTS.md](https://github.com/abap2UI5/abap2UI5/blob/main/AGENTS.md)): Clean
53+
ABAP with Hungarian prefixes, backtick string literals, string templates
54+
(`|…{ }…|`) instead of `&&`.
55+
56+
## Validation
57+
58+
Run `npx abaplint` before considering changes complete (config `abaplint.jsonc`,
59+
0 issues expected). CI:
60+
61+
* `ABAP_STANDARD` / `ABAP_CLOUD` — lint against Standard ABAP and ABAP Cloud
62+
* `renaming` (`rename_test.yaml`) — namespace-rename check
63+
* `build_rename` — manual workflow that pushes a namespace-renamed branch
64+
`rename_<name>` for a parallel install
65+
66+
There is no 702 downport: the abap2xlsx dependency has no `702` branch.
67+
All `.abap`/`.xml`/config files are LF-only (`.gitattributes` enforces it).

0 commit comments

Comments
 (0)