abapgit-agent 1.18.1 → 1.19.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.
- package/abap/CLAUDE.md +2 -3
- package/abap/guidelines/abapgit-xml-only.md +63 -3
- package/abap/guidelines/debug-session.md +2 -3
- package/package.json +2 -1
- package/src/commands/debug.js +23 -40
- package/src/commands/inspect.js +174 -70
- package/src/commands/pull.js +44 -1
- package/src/commands/unit.js +290 -200
- package/src/commands/view.js +46 -1
- package/src/utils/adt-http.js +5 -2
package/src/commands/pull.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
const { printHttpError } = require('../utils/format-error');
|
|
6
|
+
const { pollForCompletion, displayProgress } = require('../utils/backgroundJobPoller');
|
|
6
7
|
const fs = require('fs');
|
|
7
8
|
const pathModule = require('path');
|
|
8
9
|
const { execSync } = require('child_process');
|
|
@@ -295,7 +296,49 @@ Examples:
|
|
|
295
296
|
data.transport_request = transportRequest;
|
|
296
297
|
}
|
|
297
298
|
|
|
298
|
-
const
|
|
299
|
+
const rawResult = await http.post('/sap/bc/z_abapgit_agent/pull', data, { csrfToken });
|
|
300
|
+
|
|
301
|
+
// --- Async pull: ABAP returned 202 (job scheduled for >10 files) ---
|
|
302
|
+
const jobStatus = rawResult.STATUS || rawResult.status;
|
|
303
|
+
const jobNumber = rawResult.JOB_NUMBER || rawResult.jobNumber;
|
|
304
|
+
let result = rawResult;
|
|
305
|
+
|
|
306
|
+
if ((jobStatus === 'scheduled' || jobStatus === 'accepted') && jobNumber) {
|
|
307
|
+
const fileCount = (data.files || []).length;
|
|
308
|
+
if (!jsonOutput) {
|
|
309
|
+
console.log(` Activating ${fileCount} file(s) as background job...`);
|
|
310
|
+
console.log('');
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const endpoint = '/sap/bc/z_abapgit_agent/pull';
|
|
314
|
+
let finalJobResult;
|
|
315
|
+
try {
|
|
316
|
+
finalJobResult = await pollForCompletion(http, endpoint, jobNumber, {
|
|
317
|
+
pollInterval: 2000,
|
|
318
|
+
maxAttempts: 300,
|
|
319
|
+
onProgress: jsonOutput ? () => {} : (progress, message) => {
|
|
320
|
+
displayProgress(progress, message);
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
} finally {
|
|
324
|
+
if (!jsonOutput) process.stdout.write('\n');
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
if (!finalJobResult || finalJobResult.status === 'error') {
|
|
328
|
+
const errMsg = (finalJobResult && (finalJobResult.result || finalJobResult.message)) || 'Pull background job failed';
|
|
329
|
+
const err = new Error(errMsg);
|
|
330
|
+
err._isPullError = true;
|
|
331
|
+
throw err;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// Parse the result JSON string from the completed job
|
|
335
|
+
const resultStr = finalJobResult.result || finalJobResult.RESULT;
|
|
336
|
+
try {
|
|
337
|
+
result = typeof resultStr === 'string' ? JSON.parse(resultStr) : resultStr;
|
|
338
|
+
} catch (e) {
|
|
339
|
+
result = { success: '', message: 'Failed to parse pull job result' };
|
|
340
|
+
}
|
|
341
|
+
}
|
|
299
342
|
|
|
300
343
|
// Detect missing .abapgit.xml — without it abapGit's stored starting_folder
|
|
301
344
|
// may not match the actual source folder, causing pull to silently return ACTIVATED_COUNT=0
|