@abapify/p2-cli 0.0.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +168 -1
  2. package/package.json +36 -2
package/README.md CHANGED
@@ -1,3 +1,170 @@
1
1
  # @abapify/p2-cli
2
2
 
3
- Placeholder. The real release is published via CI/CD.
3
+ CLI for Eclipse P2 repositories - download, extract, and decompile plugins.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ # npm
9
+ npm install -g @abapify/p2-cli
10
+
11
+ # or run without installing globally
12
+ npx @abapify/p2-cli --help
13
+ ```
14
+
15
+ ## Development
16
+
17
+ ```bash
18
+ # From monorepo root
19
+ bun install
20
+ npx nx build p2-cli
21
+
22
+ # Or run directly with tsx
23
+ npx tsx tools/p2-cli/src/cli.ts
24
+ ```
25
+
26
+ ## Publishing Bootstrap (maintainers)
27
+
28
+ `p2-cli` is wired into workspace release publishing via `nx release`.
29
+
30
+ ```bash
31
+ # Validate npm publish/trusted-publisher readiness
32
+ bunx nx run p2-cli:npm-trust-check
33
+
34
+ # One-time bootstrap for new npm package/trusted publishing
35
+ bunx nx run p2-cli:npm-trust-check --prepare
36
+ ```
37
+
38
+ Then publish from CI using the repository release workflow (which triggers `.github/workflows/publish.yml`).
39
+
40
+ ## Commands
41
+
42
+ ### `p2 download <url>`
43
+
44
+ Download plugins from a P2 repository.
45
+
46
+ ```bash
47
+ # Download ADT plugins from SAP tools
48
+ p2 download https://tools.hana.ondemand.com/latest -o ./sdk
49
+
50
+ # Filter to specific plugins
51
+ p2 download https://tools.hana.ondemand.com/latest -o ./sdk -f "com.sap.adt.*"
52
+
53
+ # Download and extract in one step
54
+ p2 download https://tools.hana.ondemand.com/latest -o ./sdk --extract
55
+ ```
56
+
57
+ **Options:**
58
+
59
+ - `-o, --output <dir>` - Output directory (default: `./p2-download`)
60
+ - `-f, --filter <patterns>` - Filter plugins by ID pattern (comma-separated)
61
+ - `-e, --extract` - Also extract files after download
62
+ - `--extract-output <dir>` - Output directory for extraction
63
+ - `--extract-patterns <patterns>` - File patterns to extract (default: `*.xsd,*.ecore,*.genmodel,*.xml`)
64
+
65
+ ### `p2 extract <input>`
66
+
67
+ Extract files from JAR archives. Works as a general-purpose JAR extractor.
68
+
69
+ ```bash
70
+ # Extract schemas from downloaded plugins
71
+ p2 extract ./sdk/plugins -o ./extracted
72
+
73
+ # Extract specific file types
74
+ p2 extract ./sdk/plugins -o ./extracted -p "*.xsd,*.xml"
75
+
76
+ # Extract everything (no organization)
77
+ p2 extract ./sdk/plugins -o ./extracted -p "*" --no-organize
78
+
79
+ # Single JAR file
80
+ p2 extract ./my-plugin.jar -o ./extracted
81
+ ```
82
+
83
+ **Options:**
84
+
85
+ - `-o, --output <dir>` - Output directory (default: `./extracted`)
86
+ - `-p, --patterns <patterns>` - File patterns to extract (default: `*.xsd,*.ecore,*.genmodel,*.xml`)
87
+ - `--no-organize` - Do not organize files by type (flat output)
88
+ - `-v, --verbose` - Verbose output
89
+
90
+ **Organized output structure:**
91
+
92
+ ```
93
+ extracted/
94
+ ├── schemas/
95
+ │ ├── xsd/ # XML Schema definitions
96
+ │ ├── ecore/ # Eclipse EMF models
97
+ │ └── genmodel/ # Generator models
98
+ ├── templates/ # Code templates
99
+ ├── xml/ # Other XML files
100
+ ├── classes/ # Java class files (by JAR)
101
+ └── sources/ # Java source files (by JAR)
102
+ ```
103
+
104
+ ### `p2 decompile <input>`
105
+
106
+ Decompile Java class files to readable source code.
107
+
108
+ ```bash
109
+ # Decompile extracted classes
110
+ p2 decompile ./extracted/classes -o ./decompiled
111
+
112
+ # Use specific decompiler
113
+ p2 decompile ./extracted/classes -o ./decompiled -d cfr
114
+ ```
115
+
116
+ **Options:**
117
+
118
+ - `-o, --output <dir>` - Output directory (default: `./decompiled`)
119
+ - `-d, --decompiler <name>` - Decompiler to use (`cfr`, `procyon`, `fernflower`)
120
+ - `-v, --verbose` - Verbose output
121
+
122
+ **Supported decompilers:**
123
+
124
+ - **CFR** - `brew install cfr-decompiler` (macOS/Linux)
125
+ - **Procyon** - Download from GitHub
126
+ - **Fernflower** - Bundled with IntelliJ IDEA
127
+
128
+ ## Examples
129
+
130
+ ### Download SAP ADT SDK
131
+
132
+ ```bash
133
+ # Full workflow: download, extract, and organize
134
+ p2 download https://tools.hana.ondemand.com/latest \
135
+ -o ./adt-sdk \
136
+ -f "com.sap.adt.*,com.sap.conn.jco.*" \
137
+ --extract \
138
+ --extract-output ./adt-sdk/extracted
139
+
140
+ # Result:
141
+ # ./adt-sdk/
142
+ # ├── artifacts.jar
143
+ # ├── content.jar
144
+ # ├── plugins/
145
+ # │ ├── com.sap.adt.tools.core_3.54.1.jar
146
+ # │ └── ...
147
+ # └── extracted/
148
+ # ├── schemas/xsd/
149
+ # ├── schemas/ecore/
150
+ # └── ...
151
+ ```
152
+
153
+ ### Extract from existing Eclipse installation
154
+
155
+ ```bash
156
+ # macOS
157
+ p2 extract /Applications/Eclipse.app/Contents/Eclipse/plugins \
158
+ -o ./eclipse-schemas \
159
+ -p "*.xsd"
160
+
161
+ # Linux
162
+ p2 extract ~/.eclipse/*/plugins -o ./eclipse-schemas
163
+ ```
164
+
165
+ ## Requirements
166
+
167
+ - Node.js 18+
168
+ - `wget` command (for downloads)
169
+ - `unzip` command (for extraction)
170
+ - Java decompiler (optional, for decompilation)
package/package.json CHANGED
@@ -1,5 +1,39 @@
1
1
  {
2
2
  "name": "@abapify/p2-cli",
3
- "version": "0.0.0",
4
- "description": "Placeholder — real package is published via CI/CD (trusted publishing)."
3
+ "version": "0.4.0",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/abapify/adt-cli.git",
7
+ "directory": "tools/p2-cli"
8
+ },
9
+ "homepage": "https://github.com/abapify/adt-cli/tree/main/tools/p2-cli#readme",
10
+ "bugs": {
11
+ "url": "https://github.com/abapify/adt-cli/issues"
12
+ },
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
16
+ "description": "CLI for Eclipse P2 repositories - download, extract, and decompile plugins",
17
+ "license": "MIT",
18
+ "type": "module",
19
+ "engines": {
20
+ "node": ">=18"
21
+ },
22
+ "bin": {
23
+ "p2": "./dist/cli.mjs"
24
+ },
25
+ "files": [
26
+ "dist",
27
+ "README.md"
28
+ ],
29
+ "keywords": [
30
+ "sap",
31
+ "eclipse",
32
+ "p2",
33
+ "cli",
34
+ "decompiler"
35
+ ],
36
+ "dependencies": {
37
+ "commander": "*"
38
+ }
5
39
  }