simplemdg-dev-cli 1.4.0 → 1.4.1

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.
package/USER_GUIDE.md CHANGED
@@ -1,229 +1,283 @@
1
- # SimpleMDG Dev CLI
1
+ # SimpleMDG Dev CLI Guide
2
2
 
3
- SimpleMDG Dev CLI helps developers prepare local repositories, connect to SAP BTP Cloud Foundry, run CAP services, export metadata, view logs, and debug deployed apps with fewer manual commands.
3
+ ## Purpose
4
4
 
5
- ## Install
5
+ `simplemdg-dev-cli` helps SimpleMDG developers run common local development and BTP tasks without remembering long commands.
6
6
 
7
- ```powershell
8
- npm i -g simplemdg-dev-cli@latest
9
- ```
10
-
11
- Check installation:
7
+ Main command:
12
8
 
13
- ```powershell
14
- smdg --help
9
+ ```bash
10
+ smdg
15
11
  ```
16
12
 
17
- You can also use:
13
+ Install:
18
14
 
19
- ```powershell
20
- simplemdg --help
15
+ ```bash
16
+ npm i -g simplemdg-dev-cli@latest
21
17
  ```
22
18
 
23
- ## Interactive guide
24
-
25
- Run:
19
+ Open this guide:
26
20
 
27
- ```powershell
28
- smdg --help
21
+ ```bash
22
+ smdg guide
29
23
  ```
30
24
 
31
- You can choose one of these options:
32
-
33
- - View quick guide in terminal
34
- - Open visual guide in browser
35
- - Show command help
25
+ ---
36
26
 
37
- You can also open the guide directly:
27
+ # Select Usage
38
28
 
39
- ```powershell
40
- smdg guide
41
- ```
29
+ When the CLI shows a select list:
42
30
 
43
- Open visual local guide:
31
+ * Type a few characters to search.
32
+ * Use `↑` and `↓` to move.
33
+ * Press `Enter` to select.
34
+ * If no item matches, some prompts allow using the typed value.
44
35
 
45
- ```powershell
46
- smdg guide --web
47
- ```
36
+ This is useful for long lists of BTP orgs, spaces, apps, package IDs, CAP profiles, and CDS services.
48
37
 
49
- Print guide in terminal:
38
+ ---
50
39
 
51
- ```powershell
52
- smdg guide --terminal
53
- ```
40
+ # Common Commands
54
41
 
55
- ## Common usage
42
+ ## `smdg npmrc import`
56
43
 
57
- ### Create `.npmrc`
44
+ Import SimpleMDG GitLab package IDs into local cache.
58
45
 
59
- Import SimpleMDG GitLab package IDs first:
46
+ Use this after downloading the package ID import file from the team.
60
47
 
61
- ```powershell
62
- smdg npmrc import --file simplemdg-package-ids-import.txt
48
+ ```bash
49
+ smdg npmrc import
63
50
  ```
64
51
 
65
- Create `.npmrc`:
52
+ ## `smdg npmrc create`
53
+
54
+ Create `.npmrc` for SimpleMDG private npm packages.
66
55
 
67
- ```powershell
56
+ ```bash
68
57
  smdg npmrc create
69
58
  ```
70
59
 
71
- The CLI caches package IDs with names, scopes, GitLab hosts, and tokens, so you can select them quickly next time.
60
+ The CLI helps select package name/package ID and token from cache.
72
61
 
73
- ### Install project dependencies
62
+ ## `smdg i`
74
63
 
75
- ```powershell
64
+ Install dependencies for the current project.
65
+
66
+ ```bash
76
67
  smdg i
77
68
  ```
78
69
 
79
- This scans placeholders like `${SIMPLEMDG_BRANCH}` and asks for replacement values before running install. It helps avoid manually replacing values in `package.json`.
80
-
81
- Full command:
70
+ It can scan variables such as `${SIMPLEMDG_BRANCH}` and ask for replacement values automatically.
82
71
 
83
- ```powershell
84
- smdg install
85
- ```
72
+ ## `smdg cf login`
86
73
 
87
- ### Login to BTP / Cloud Foundry
74
+ Login to BTP Cloud Foundry.
88
75
 
89
- ```powershell
76
+ ```bash
90
77
  smdg cf login
91
78
  ```
92
79
 
93
- The CLI asks for the CF API endpoint, username, and password. Then it scans available orgs and spaces based on your account permission.
80
+ The CLI helps select API endpoint, org, and space. Choose to save the password on your own machine if you want automatic re-login for org switching, logs, app listing, and debugging.
81
+
82
+ It can save login information on your local machine so later commands can re-login automatically when the CF session expires.
83
+
84
+ ## `smdg cf org`
94
85
 
95
- ### Switch org across regions
86
+ Search, list, and switch Cloud Foundry orgs across regions.
96
87
 
97
- ```powershell
88
+ ```bash
98
89
  smdg cf org
99
90
  ```
100
91
 
101
- Use this when you already logged in and only want to list or switch org/space. The org list shows both region and org name.
92
+ The CLI scans known and cached BTP region endpoints and shows orgs from different regions in one searchable list. If the CF session for a region is expired, the CLI automatically re-authenticates by using the username/password saved from `smdg cf login`.
102
93
 
103
- ### Check current target
94
+ The list includes region information, for example:
95
+
96
+ ```txt
97
+ arthrex-dev-simplemdg eu10 · 1 space
98
+ alcon-dev-simplemdg br10 · 1 space
99
+ ait-dev-simplemdg us21 · 1 space
100
+ ```
104
101
 
105
- ```powershell
102
+ Use this when you have many orgs across many BTP regions. Run `smdg cf login` once and choose to save the password on your machine so org switching, app listing, logs, and debug can re-login automatically when the CF session expires.
103
+
104
+ ## `smdg cf target`
105
+
106
+ Show the current Cloud Foundry target.
107
+
108
+ ```bash
106
109
  smdg cf target
107
110
  ```
108
111
 
109
- ### List BTP apps
112
+ It shows API endpoint, user, org, and space.
113
+
114
+ ## `smdg cf apps`
115
+
116
+ List BTP apps in the current org and space.
110
117
 
111
- ```powershell
118
+ ```bash
112
119
  smdg cf apps
113
120
  ```
114
121
 
115
- This shows cached apps immediately and refreshes the cache in the background.
122
+ The CLI uses cache first for speed and refreshes in the background.
116
123
 
117
- Force refresh:
124
+ ## `smdg cf bind`
118
125
 
119
- ```powershell
120
- smdg cf apps --refresh
126
+ Bind the local CAP project to a deployed BTP app service.
127
+
128
+ ```bash
129
+ smdg cf bind
121
130
  ```
122
131
 
123
- ### Bind local CAP service to BTP app services
132
+ This helps run `cds bind --to-app-services` and update `.cdsrc-private.json`.
124
133
 
125
- ```powershell
126
- smdg cf bind
134
+ ## `smdg cf env`
135
+
136
+ Export BTP app environment variables to a clean JSON file.
137
+
138
+ ```bash
139
+ smdg cf env
127
140
  ```
128
141
 
129
- The CLI lets you select a BTP app and runs:
142
+ Useful for creating `default-env.json`.
143
+
144
+ ## `smdg cds watch`
145
+
146
+ Run CAP locally.
130
147
 
131
- ```powershell
132
- cds bind --to-app-services <app-name>
148
+ ```bash
149
+ smdg cds watch
133
150
  ```
134
151
 
135
- ### Export BTP env to clean JSON
152
+ The CLI helps select CAP profile and port.
136
153
 
137
- ```powershell
138
- smdg cf env
154
+ ## `smdg cf logs`
155
+
156
+ View BTP app logs.
157
+
158
+ ```bash
159
+ smdg cf logs
139
160
  ```
140
161
 
141
- Or write directly to `default-env.json`:
162
+ It can be used for realtime log monitoring.
163
+
164
+ ## `smdg cf debug`
142
165
 
143
- ```powershell
144
- smdg cf env --out default-env.json
166
+ Debug a deployed BTP Cloud Foundry Node.js app.
167
+
168
+ ```bash
169
+ smdg cf debug
145
170
  ```
146
171
 
147
- Export raw CF output for debugging:
172
+ The CLI guides you through:
173
+
174
+ * selecting current target or searching orgs across regions
175
+ * selecting BTP app
176
+ * selecting debug mode
177
+ * selecting app instance
178
+ * preparing Node.js inspector
179
+ * creating VS Code attach config
180
+ * opening the CF SSH tunnel
148
181
 
149
- ```powershell
150
- smdg cf env --raw --out default-envBTP.raw.txt
182
+ Recommended mode:
183
+
184
+ ```txt
185
+ VS Code guided debugging
151
186
  ```
152
187
 
153
- ### Run CAP watch
188
+ Important VS Code note:
154
189
 
155
- ```powershell
156
- smdg cds watch
190
+ The debug toolbar buttons such as pause, step over, restart, and stop only appear after VS Code successfully attaches to the running Node.js inspector.
191
+
192
+ Normal flow:
193
+
194
+ 1. Run `smdg cf debug`.
195
+ 2. Select `VS Code guided debugging`.
196
+ 3. First time for an app, select `Set NODE_OPTIONS and restart app`.
197
+ 4. Keep the terminal open because it owns the CF SSH tunnel.
198
+ 5. In VS Code, open Run and Debug with `Ctrl+Shift+D`.
199
+ 6. Select `Attach BTP <app-name>`.
200
+ 7. Press `F5` or the green Start Debugging button.
201
+ 8. After attach succeeds, the debug toolbar appears.
202
+
203
+ Use this mainly in dev/test environments because enabling Node inspector restarts the BTP app.
204
+
205
+ ## `smdg cds compline`
206
+
207
+ Generate metadata XML from CDS services.
208
+
209
+ ```bash
210
+ smdg cds compline
157
211
  ```
158
212
 
159
- The CLI scans CAP profiles and asks for a port.
213
+ The CLI scans CDS services, suggests output XML names, and writes XML using UTF-8 encoding.
214
+
215
+ ---
160
216
 
161
- Quick command:
217
+ # Recommended Daily Flow
162
218
 
163
- ```powershell
164
- smdg cds watch --profile hybrid --port 4005
219
+ ```bash
220
+ smdg npmrc create
221
+ smdg i
222
+ smdg cf login
223
+ smdg cf apps
224
+ smdg cf bind
225
+ smdg cf env
226
+ smdg cds watch
165
227
  ```
166
228
 
167
- ### View BTP logs realtime
229
+ For logs:
168
230
 
169
- ```powershell
231
+ ```bash
170
232
  smdg cf logs
171
233
  ```
172
234
 
173
- Export recent logs:
235
+ For BTP debugging:
174
236
 
175
- ```powershell
176
- smdg cf logs --recent --out logs/app.log
237
+ ```bash
238
+ smdg cf debug
177
239
  ```
178
240
 
179
- ### Export CAP metadata XML
241
+ For metadata XML:
180
242
 
181
- ```powershell
243
+ ```bash
182
244
  smdg cds compline
183
245
  ```
184
246
 
185
- Default output format is `edmx`. The CLI scans CAP services, suggests output XML names, and writes files using UTF-8 encoding.
247
+ ---
186
248
 
187
- Quick command:
249
+ # Key Features
188
250
 
189
- ```powershell
190
- smdg cds compline --to edmx --service MainService --out srv_config_main.xml
191
- ```
251
+ ## Private npm registry helper
192
252
 
193
- ### Debug BTP app
253
+ Creates `.npmrc` for SimpleMDG GitLab npm packages and caches package IDs with readable names.
194
254
 
195
- ```powershell
196
- smdg cf debug
197
- ```
255
+ ## Smart install helper
198
256
 
199
- The CLI asks you to select:
257
+ Scans project variables like `${SIMPLEMDG_BRANCH}` and asks for values automatically before install.
200
258
 
201
- - org/space mode
202
- - BTP app
203
- - debug mode
204
- - app instance
205
- - local debug port
259
+ ## Cloud Foundry helper
206
260
 
207
- It can generate VS Code attach config, open a CF SSH tunnel, print Chrome DevTools links, or check/enable SSH.
261
+ Helps with login, target checking, org switching, app list, binding, env export, logs, and debugging.
208
262
 
209
- ## How to use CLI select screens
263
+ ## Across-region org search
210
264
 
211
- When the CLI shows a select list:
265
+ Scans known and cached BTP regions and shows orgs from many regions in one searchable list. The CLI now re-authenticates per region using the cached login profile, so switching orgs should not fail just because `cf api` changed to another region.
212
266
 
213
- - Type a few characters to search.
214
- - Use `↑` and `↓` to move.
215
- - Press `Enter` to select.
216
- - If no item matches, press `Enter` to use the value you typed.
267
+ ## CAP helper
217
268
 
218
- ## Recommended local service flow
269
+ Helps run `cds watch`, select profiles/ports, and generate CDS metadata XML.
219
270
 
220
- ```powershell
221
- smdg npmrc create
222
- smdg i
223
- smdg cf login
224
- smdg cf target
225
- smdg cf apps
226
- smdg cf bind
227
- smdg cf env --out default-env.json
228
- smdg cds watch --profile hybrid --port 4005
229
- ```
271
+ ## VS Code BTP debugging
272
+
273
+ Creates VS Code attach config and opens a CF SSH tunnel to debug BTP Node.js apps from local source code. For the first debug session of an app, use `Set NODE_OPTIONS and restart app`; later sessions can use `Inspector is already enabled`.
274
+
275
+ ---
276
+
277
+ # Notes
278
+
279
+ Do not commit real secrets to Git.
280
+
281
+ Files like `.npmrc`, `default-env.json`, and cached passwords may contain sensitive data.
282
+
283
+ Use saved password only on your own machine.