abapgit-agent 1.16.2 → 1.16.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abapgit-agent",
3
- "version": "1.16.2",
3
+ "version": "1.16.3",
4
4
  "description": "ABAP Git Agent - Pull and activate ABAP code via abapGit from any git repository",
5
5
  "files": [
6
6
  "bin/",
@@ -50,14 +50,26 @@ Examples:
50
50
 
51
51
  // Get parameters from config
52
52
  const safeguards = getSafeguards();
53
+
54
+ // disableImport check — bypass if current user is in importAllowedUsers
53
55
  if (safeguards.disableImport) {
54
- console.error('❌ Error: import command is disabled for this project\n');
55
- if (safeguards.reason) {
56
- console.error(`Reason: ${safeguards.reason}\n`);
56
+ const config0 = loadConfig();
57
+ const currentUser = (config0.user || '').toUpperCase();
58
+ const allowedUsers = safeguards.importAllowedUsers || [];
59
+ const isAllowed = allowedUsers.length > 0 && allowedUsers.includes(currentUser);
60
+
61
+ if (!isAllowed) {
62
+ console.error('❌ Error: import command is disabled for this project\n');
63
+ if (safeguards.reason) {
64
+ console.error(`Reason: ${safeguards.reason}\n`);
65
+ }
66
+ if (allowedUsers.length > 0) {
67
+ console.error(`Allowed users: ${allowedUsers.join(', ')}`);
68
+ }
69
+ console.error('The import command has been disabled in .abapgit-agent.json');
70
+ console.error('Please contact the project maintainer to enable it.');
71
+ process.exit(1);
57
72
  }
58
- console.error('The import command has been disabled in .abapgit-agent.json');
59
- console.error('Please contact the project maintainer to enable it.');
60
- process.exit(1);
61
73
  }
62
74
 
63
75
  // Get parameters from config
@@ -75,6 +87,16 @@ Examples:
75
87
  commitMessage = args[messageArgIndex + 1];
76
88
  }
77
89
 
90
+ if (safeguards.requireImportMessage && !commitMessage) {
91
+ console.error('❌ Error: import requires a commit message for this project\n');
92
+ console.error('Please provide one with:');
93
+ console.error(' abapgit-agent import --message "Your descriptive message"\n');
94
+ if (safeguards.reason) {
95
+ console.error(`Reason: ${safeguards.reason}\n`);
96
+ }
97
+ process.exit(1);
98
+ }
99
+
78
100
  console.log(`\n📦 Starting import job`);
79
101
  console.log(` URL: ${repoUrl}`);
80
102
  if (commitMessage) {
package/src/config.js CHANGED
@@ -119,11 +119,21 @@ function getSafeguards() {
119
119
  const projectConfig = loadProjectConfig();
120
120
 
121
121
  if (projectConfig?.safeguards) {
122
+ // importAllowedUsers: accept string (single) or array; normalize to uppercase array
123
+ const rawAllowed = projectConfig.safeguards.importAllowedUsers;
124
+ let importAllowedUsers = null;
125
+ if (rawAllowed) {
126
+ const arr = Array.isArray(rawAllowed) ? rawAllowed : [rawAllowed];
127
+ importAllowedUsers = arr.map(u => String(u).toUpperCase());
128
+ }
129
+
122
130
  return {
123
131
  requireFilesForPull: projectConfig.safeguards.requireFilesForPull === true,
124
132
  disablePull: projectConfig.safeguards.disablePull === true,
125
133
  disableRun: projectConfig.safeguards.disableRun === true,
126
134
  disableImport: projectConfig.safeguards.disableImport === true,
135
+ requireImportMessage: projectConfig.safeguards.requireImportMessage === true,
136
+ importAllowedUsers,
127
137
  disableProbeClasses: projectConfig.safeguards.disableProbeClasses === true,
128
138
  reason: projectConfig.safeguards.reason || null
129
139
  };
@@ -135,6 +145,8 @@ function getSafeguards() {
135
145
  disablePull: false,
136
146
  disableRun: false,
137
147
  disableImport: false,
148
+ requireImportMessage: false,
149
+ importAllowedUsers: null,
138
150
  disableProbeClasses: false,
139
151
  reason: null
140
152
  };