secrez 2.1.7 → 2.1.8

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/.env ADDED
@@ -0,0 +1,9 @@
1
+ SECREZ_TEST_REPO_URL="git@github.com:secrez/test-repo.git"
2
+ SECREZ_TEST_SSH_KEY="-----BEGIN OPENSSH PRIVATE KEY-----
3
+ b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
4
+ QyNTUxOQAAACB8/5MMxGmWhwKsCKzu2bC2WhWdV6BiS/c2IVMJZ10NxQAAAKBOc1L6TnNS
5
+ +gAAAAtzc2gtZWQyNTUxOQAAACB8/5MMxGmWhwKsCKzu2bC2WhWdV6BiS/c2IVMJZ10NxQ
6
+ AAAEB8z+vtbfcUQyatLMOea+l7Ku4xbFbgB1Fyzymvo0T4Vnz/kwzEaZaHAqwIrO7ZsLZa
7
+ FZ1XoGJL9zYhUwlnXQ3FAAAAF3NlY3Jlei10ZXN0QGV4YW1wbGUuY29tAQIDBAUG
8
+ -----END OPENSSH PRIVATE KEY-----"
9
+ PUBLIC_TEST_KEY="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHz/kwzEaZaHAqwIrO7ZsLZaFZ1XoGJL9zYhUwlnXQ3F secrez-test@example.com"
package/README.md CHANGED
@@ -152,6 +152,7 @@ Available commands:
152
152
  edit Edits a file containing a secret.
153
153
  export Export encrypted data to the OS in the current local folder
154
154
  find Find a secret.
155
+ git Checks if there is a repo and if there are conflict risks.
155
156
  help This help.
156
157
  import Import files from the OS into the current folder
157
158
  lcat Similar to a standard cat in the external fs.
@@ -369,6 +370,11 @@ Secrez is not intended to compete with password managers, so do not expect it to
369
370
 
370
371
  ## History
371
372
 
373
+ **2.1.8**
374
+
375
+ - add `git` command to check repository status and detect remote changes
376
+ - add git conflict detection middleware to prevent conflicts during data-changing operations
377
+
372
378
  **2.1.7**
373
379
 
374
380
  - add option `--no-export` to `export --crypto-env` to display the encrypted content in the console instead of writing it to a file
package/coverage.report CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- > secrez@2.1.7 test /Users/francescosullo/Projects/Secrez/secrez/packages/secrez
2
+ > secrez@2.1.8 test /Users/francescosullo/Projects/Secrez/secrez/packages/secrez
3
3
  > cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text mocha test/*.test.js test/**/*.test.js test/**/**/*.js --exit
4
4
 
5
5
 
@@ -29,10 +29,10 @@
29
29
  #Cat
30
30
  ✓ should return the help
31
31
  ✓ should show the content of a file
32
- ✓ should show either one or all the versions of a file (1013ms)
32
+ ✓ should show either one or all the versions of a file (1014ms)
33
33
  ✓ should throw if entry is not a file or file does not exist
34
34
  ✓ should throw if trying to cat a binary file
35
- ✓ should show the content of a Yaml file (1017ms)
35
+ ✓ should show the content of a Yaml file (1029ms)
36
36
 
37
37
  #Cd
38
38
  ✓ should return the help
@@ -51,10 +51,10 @@
51
51
 
52
52
  #Copy
53
53
  ✓ should return the help
54
- ✓ should copy a file to the clipboard (402ms)
55
- ✓ should copy a string to the clipboard (266ms)
56
- ✓ should copy a card to the clipboard (960ms)
57
- ✓ should return an error if the file does not exist or is a folder (48ms)
54
+ ✓ should copy a file to the clipboard (413ms)
55
+ ✓ should copy a string to the clipboard (258ms)
56
+ ✓ should copy a card to the clipboard (1001ms)
57
+ ✓ should return an error if the file does not exist or is a folder (50ms)
58
58
  ✓ should throw if copying to clipboard a binary files
59
59
 
60
60
  #Ds
@@ -70,9 +70,9 @@
70
70
  ✓ should export a file encrypted only for the user itself
71
71
  ✓ should export a binary file to the current local folder
72
72
  ✓ should export an encrypted file to the current local folder
73
- ✓ should export a file and delete it after 1 second (1205ms)
73
+ ✓ should export a file and delete it after 1 second (1204ms)
74
74
  ✓ should return an error if the file does not exist or is a folder
75
- ✓ should export a keystore json file if a private_key exists in the entry (922ms)
75
+ ✓ should export a keystore json file if a private_key exists in the entry (711ms)
76
76
  ✓ should export a cryptoenv file if a private_key exists in the entry
77
77
  ✓ should export a cryptoenv file with entire content when no private_key fields exist and user confirms
78
78
  ✓ should throw error when no private_key fields exist and user declines
@@ -81,10 +81,17 @@
81
81
 
82
82
  #Find
83
83
  ✓ should return the help
84
- ✓ should show find a string in the tree (1022ms)
84
+ ✓ should show find a string in the tree (1033ms)
85
85
  ✓ should find no result without parameters
86
86
  ✓ should skip binary files from search
87
87
 
88
+ #Git
89
+ ✓ should return the help
90
+ ✓ should show git status when --status is used (3396ms)
91
+ ✓ should show git status by default (3521ms)
92
+ ✓ should handle conflict risk scenario (5238ms)
93
+ ✓ should handle non-git repository
94
+
88
95
  #Help
89
96
  ✓ should return the help
90
97
  ✓ #execAsync and format
@@ -146,7 +153,7 @@
146
153
 
147
154
  #Mv
148
155
  ✓ should return the help
149
- ✓ should rename a file (1010ms)
156
+ ✓ should rename a file (1014ms)
150
157
  ✓ should move a file to another folder
151
158
  ✓ should move many files to another folder
152
159
  ✓ should move a file to another subfolder
@@ -155,13 +162,13 @@
155
162
  ✓ should move file to another dataset using wildcards
156
163
  ✓ should move file managing duplicates
157
164
  ✓ should throw if parameters are missed or wrong
158
- ✓ should move files from and to other datasets (1014ms)
165
+ ✓ should move files from and to other datasets (1025ms)
159
166
  ✓ should move the results of a find
160
167
 
161
168
  #Paste
162
169
  ✓ should return the help
163
- ✓ should paste the clipboard content to a new file (61ms)
164
- ✓ should paste the clipboard content to an existent file (86ms)
170
+ ✓ should paste the clipboard content to a new file (50ms)
171
+ ✓ should paste the clipboard content to an existent file (70ms)
165
172
  ✓ should paste a single field to a yml card
166
173
 
167
174
  #Pwd
@@ -176,7 +183,7 @@
176
183
  ✓ should delete a file with one version
177
184
  ✓ should delete many files usign wildcards
178
185
  ✓ should return errors if wrong parameters
179
- ✓ should delete some versions of a file (1009ms)
186
+ ✓ should delete some versions of a file (1010ms)
180
187
 
181
188
  #Shell
182
189
  ✓ should return the help
@@ -196,13 +203,13 @@
196
203
 
197
204
  #Totp
198
205
  ✓ should return the help
199
- ✓ should totp a file to the clipboard (394ms)
200
- ✓ should read a totp secret from an image and add the totp field to the card (44ms)
206
+ ✓ should totp a file to the clipboard (407ms)
207
+ ✓ should read a totp secret from an image and add the totp field to the card (39ms)
201
208
  ✓ should read a totp secret from an image and return the secret
202
209
  ✓ should throw if bad image
203
210
  ✓ should throw if missing parameters
204
211
  ✓ should throw if the yaml is malformed
205
- ✓ should read a totp secret from the clipboard (242ms)
212
+ ✓ should read a totp secret from the clipboard (435ms)
206
213
 
207
214
  #Touch
208
215
  ✓ should return the help
@@ -215,7 +222,7 @@
215
222
  ✓ should throw if wrong parameters
216
223
  ✓ should create a file and generate a wallet
217
224
  New file "/folder2/file1" created.
218
- ✓ should generate 5 prefixed wallet (65ms)
225
+ ✓ should generate 5 prefixed wallet (66ms)
219
226
  New file "/folder2/file1" created.
220
227
  ✓ should generate a wallet with mnemonic and 2 keys
221
228
 
@@ -231,7 +238,7 @@ New file "/folder2/file1" created.
231
238
  ✓ should see who am I
232
239
 
233
240
 
234
- 155 passing (14s)
241
+ 160 passing (31s)
235
242
  1 pending
236
243
  1 failing
237
244
 
@@ -252,43 +259,44 @@ New file "/folder2/file1" created.
252
259
  --------------------|---------|----------|---------|---------|--------------------------------------
253
260
  File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
254
261
  --------------------|---------|----------|---------|---------|--------------------------------------
255
- All files | 81.06 | 67.92 | 81.15 | 80.95 |
256
- src | 57.84 | 53.62 | 52.63 | 58.41 |
257
- Command.js | 79.66 | 78.72 | 76.92 | 81.03 | 32,55-62,73,80,119
262
+ All files | 80.15 | 67.58 | 81.49 | 80.04 |
263
+ src | 55.75 | 52.05 | 55 | 56.25 |
264
+ Command.js | 72.85 | 74.5 | 78.57 | 73.91 | 32,55-62,73,80,119,145-156,163-166
258
265
  PreCommand.js | 8.82 | 0 | 0 | 8.82 | 6-97
259
266
  cliConfig.js | 100 | 100 | 100 | 100 |
260
- src/commands | 83.81 | 69.51 | 90.64 | 83.7 |
261
- Alias.js | 90.54 | 77.35 | 100 | 90.41 | 101,112,139,169,173,180,190
267
+ src/commands | 82.85 | 69.14 | 90.82 | 82.73 |
268
+ Alias.js | 88.6 | 78.68 | 100 | 88.46 | 101,112,139,169,173,180,190,213-214
262
269
  Bash.js | 75 | 0 | 66.66 | 75 | 18-19
263
270
  Cat.js | 98.9 | 88.88 | 100 | 98.9 | 152
264
271
  Cd.js | 96.42 | 86.66 | 100 | 96.42 | 44
265
- Conf.js | 9.09 | 0 | 20 | 9.09 | 98-500
266
- Contacts.js | 87.17 | 74.32 | 100 | 87.06 | ...5-141,145,165,172,184,237,250,260
272
+ Conf.js | 8.64 | 0 | 20 | 8.64 | 98-509
273
+ Contacts.js | 86.06 | 75.6 | 100 | 85.95 | ...5,165,172,184,237,250,260,268-269
267
274
  Copy.js | 91.2 | 71.92 | 100 | 91.11 | 115,166,183,205-210,225-226,253
268
- Ds.js | 92.53 | 82.05 | 100 | 92.42 | 99,108-113,125
269
- Edit.js | 13.58 | 0 | 40 | 13.58 | 88-214
275
+ Ds.js | 90.27 | 82.6 | 100 | 90.14 | 99,108-113,125,147-148
276
+ Edit.js | 12.94 | 0 | 40 | 12.94 | 88-222
270
277
  Export.js | 90.17 | 76.92 | 100 | 90.17 | ...3-198,209,227-231,236,248,257,260
271
278
  Find.js | 93.58 | 86.66 | 100 | 93.42 | 101,164,200-203,209
279
+ Git.js | 92.3 | 66.66 | 100 | 92.3 | 40,61
272
280
  Help.js | 100 | 80 | 100 | 100 | 29
273
- Import.js | 93.2 | 85.48 | 100 | 93.13 | ...5,365,367,387,393,441,456-463,490
281
+ Import.js | 92.41 | 85.38 | 100 | 92.34 | ...7,387,393,441,457-458,466-473,500
274
282
  Lcat.js | 100 | 85.71 | 100 | 100 | 54
275
283
  Lcd.js | 95.65 | 81.81 | 100 | 95.65 | 50
276
284
  Lls.js | 95.45 | 72.72 | 100 | 95.45 | 97
277
285
  Lpwd.js | 92.3 | 100 | 100 | 92.3 | 36
278
286
  Ls.js | 91.3 | 75 | 100 | 90.76 | 103,114-116,130,181
279
- Mkdir.js | 100 | 66.66 | 100 | 100 | 38-44
280
- Mv.js | 88.04 | 73.21 | 100 | 87.77 | 93-99,133,155,165-172
281
- Paste.js | 87.23 | 75 | 100 | 87.23 | 72,78,81,89,113,129
287
+ Mkdir.js | 92.59 | 60 | 100 | 92.59 | 56-57
288
+ Mv.js | 86.59 | 71.66 | 100 | 86.31 | 93-99,133,155-156,165,175-182
289
+ Paste.js | 84.61 | 70.83 | 100 | 84.61 | 72,78,81,89,113,130-131,139
282
290
  Pwd.js | 92.3 | 100 | 100 | 92.3 | 33
283
291
  Quit.js | 90 | 50 | 100 | 90 | 27
284
- Rm.js | 94 | 80.95 | 100 | 93.87 | 63,126,134
292
+ Rm.js | 90.9 | 76 | 100 | 90.74 | 63,125-126,136,144
285
293
  Shell.js | 88.23 | 60 | 100 | 88.23 | 38,55
286
294
  Show.js | 72 | 45.45 | 57.14 | 73.46 | ...8,100,106-114,117,123-126,132,143
287
295
  Ssh.js | 25 | 0 | 40 | 25 | 72-120
288
- Tag.js | 98.03 | 92.3 | 100 | 98.01 | 122,171
289
- Totp.js | 93.75 | 72.72 | 100 | 93.75 | 189-190,230,240,282-287
290
- Touch.js | 96 | 81.48 | 100 | 95.91 | 164,231
291
- Use.js | 96.77 | 89.47 | 100 | 96.77 | 68
296
+ Tag.js | 96.26 | 91.37 | 100 | 96.22 | 122,171,204-205
297
+ Totp.js | 92.07 | 74.19 | 100 | 92.07 | 189-190,230,240,282-287,301-302
298
+ Touch.js | 92.72 | 77.41 | 100 | 92.59 | 164,187-188,240
299
+ Use.js | 91.66 | 86.95 | 100 | 91.66 | 68,83-84
292
300
  Ver.js | 90 | 66.66 | 100 | 90 | 25
293
301
  Whoami.js | 83.33 | 60 | 80 | 83.33 | 27,35,48
294
302
  index.js | 87.5 | 50 | 100 | 86.95 | 15,22,31
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "secrez",
3
- "version": "2.1.7",
3
+ "version": "2.1.8",
4
4
  "license": "MIT",
5
5
  "nyc": {
6
6
  "include": "src",
@@ -10,7 +10,7 @@
10
10
  "@secrez/core": "~1.0.5",
11
11
  "@secrez/crypto": "~1.0.4",
12
12
  "@secrez/eth": "~0.0.4",
13
- "@secrez/fs": "~1.0.5",
13
+ "@secrez/fs": "~1.0.6",
14
14
  "@secrez/utils": "~1.0.4",
15
15
  "case": "^1.6.3",
16
16
  "chalk": "^3.0.0",
@@ -33,6 +33,7 @@
33
33
  "chai": "^4.5.0",
34
34
  "chalk": "^3.0.0",
35
35
  "cross-env": "^7.0.3",
36
+ "dotenv": "^17.2.2",
36
37
  "mocha": "^7.2.0",
37
38
  "nyc": "^15.1.0",
38
39
  "test-console": "^1.1.0"
package/src/Command.js CHANGED
@@ -131,6 +131,41 @@ class Command extends PreCommand {
131
131
  }
132
132
  }
133
133
  }
134
+
135
+ /**
136
+ * Check for git conflicts before performing data-changing operations
137
+ * Returns true if the operation should proceed, false if it should be cancelled
138
+ */
139
+ async checkGitConflictsBeforeOperation() {
140
+ try {
141
+ const conflictCheck = await this.internalFs.checkGitSyncStatus();
142
+
143
+ if (conflictCheck.hasRisk) {
144
+ // Show the warning message
145
+ this.Logger.yellow(conflictCheck.message);
146
+
147
+ // Ask user if they want to continue
148
+ const shouldContinue = await this.useInput({
149
+ type: "confirm",
150
+ message: "Do you want to continue anyway?",
151
+ default: false,
152
+ });
153
+
154
+ if (!shouldContinue) {
155
+ this.Logger.grey("Operation cancelled.");
156
+ return false;
157
+ }
158
+ }
159
+
160
+ return true;
161
+ } catch (e) {
162
+ // If git check fails, log a warning but continue
163
+ this.Logger.yellow(
164
+ "Warning: Could not check git status. Proceeding anyway."
165
+ );
166
+ return true;
167
+ }
168
+ }
134
169
  }
135
170
 
136
171
  module.exports = Command;
@@ -200,6 +200,21 @@ class Alias extends require("../Command") {
200
200
  }
201
201
  try {
202
202
  this.validate(options);
203
+
204
+ // Check for git conflicts before creating/modifying/deleting aliases
205
+ if (
206
+ options.commandLine ||
207
+ options.previousCommand ||
208
+ options.rename ||
209
+ options.delete
210
+ ) {
211
+ const shouldProceed = await this.checkGitConflictsBeforeOperation();
212
+ if (!shouldProceed) {
213
+ await this.prompt.run();
214
+ return;
215
+ }
216
+ }
217
+
203
218
  let result = await this.alias(options);
204
219
  if (!Array.isArray(result)) {
205
220
  result = [result];
@@ -486,6 +486,15 @@ class Conf extends require("../Command") {
486
486
  // options.list = true
487
487
  // }
488
488
  this.validate(options);
489
+
490
+ // Check for git conflicts before changing password or iterations
491
+ if (options.newPassword || options.newIterationsNumber) {
492
+ const shouldProceed = await this.checkGitConflictsBeforeOperation();
493
+ if (!shouldProceed) {
494
+ return;
495
+ }
496
+ }
497
+
489
498
  // if (options.fido2 && options.recoveryCode) {
490
499
  // throw new Error('Conflicting params. Launch "conf -h" for examples.')
491
500
  // }
@@ -260,6 +260,16 @@ class Contacts extends require("../Command") {
260
260
  options.list = true;
261
261
  }
262
262
  this.validate(options);
263
+
264
+ // Check for git conflicts before adding/updating/deleting contacts
265
+ if (options.add || options.update || options.delete || options.rename) {
266
+ const shouldProceed = await this.checkGitConflictsBeforeOperation();
267
+ if (!shouldProceed) {
268
+ await this.prompt.run();
269
+ return;
270
+ }
271
+ }
272
+
263
273
  let result = await this.contacts(options);
264
274
  if (!Array.isArray(result)) {
265
275
  result = [result];
@@ -139,6 +139,16 @@ class Ds extends require("../Command") {
139
139
  options.list = true;
140
140
  }
141
141
  this.validate(options);
142
+
143
+ // Check for git conflicts before creating/renaming/deleting datasets
144
+ if (options.create || options.rename || options.delete) {
145
+ const shouldProceed = await this.checkGitConflictsBeforeOperation();
146
+ if (!shouldProceed) {
147
+ await this.prompt.run();
148
+ return;
149
+ }
150
+ }
151
+
142
152
  let result = await this.ds(options);
143
153
  if (result) {
144
154
  if (options.list) {
@@ -184,6 +184,14 @@ class Edit extends require("../Command") {
184
184
  this.validate(options, {
185
185
  path: true,
186
186
  });
187
+
188
+ if (!options.help) {
189
+ // Check for git conflicts before editing files (edit always changes something)
190
+ const shouldProceed = await this.checkGitConflictsBeforeOperation();
191
+ if (!shouldProceed) {
192
+ return;
193
+ }
194
+ }
187
195
  currentEditor = process.env.EDITOR;
188
196
  if (options.internal) {
189
197
  process.env.EDITOR = this.getTinyCliEditorBinPath();
@@ -0,0 +1,67 @@
1
+ const chalk = require("chalk");
2
+ const { yamlStringify } = require("@secrez/utils");
3
+
4
+ class Git extends require("../Command") {
5
+ setHelpAndCompletion() {
6
+ this.cliConfig.completion.git = {
7
+ _func: this.selfCompletion(this),
8
+ _self: this,
9
+ };
10
+ this.cliConfig.completion.help.git = true;
11
+ this.optionDefinitions = [
12
+ {
13
+ name: "help",
14
+ alias: "h",
15
+ type: Boolean,
16
+ },
17
+ {
18
+ name: "status",
19
+ alias: "s",
20
+ type: Boolean,
21
+ },
22
+ ];
23
+ }
24
+
25
+ help() {
26
+ return {
27
+ description: ["Check a git repository status."],
28
+ examples: [["git -s", "Check the git repository status"]],
29
+ };
30
+ }
31
+
32
+ async git(options = {}) {
33
+ const isGit = await this.internalFs.gitConflictChecker.isGitRepository();
34
+ if (isGit) {
35
+ if (options.status) {
36
+ let status = await this.internalFs.gitConflictChecker.getGitStatus();
37
+ let warning =
38
+ await this.internalFs.gitConflictChecker.getWarningMessage(status);
39
+ if (warning) {
40
+ return chalk.yellow(warning);
41
+ } else return "No remote changes found.";
42
+ }
43
+ } else {
44
+ return "Not a git repository";
45
+ }
46
+ }
47
+
48
+ async exec(options = {}) {
49
+ if (options.help) {
50
+ return this.showHelp();
51
+ }
52
+ try {
53
+ // if the user didn't pass any option, we default to options.status
54
+ if (!Object.keys(options).length) {
55
+ options.status = true;
56
+ }
57
+ this.validate(options);
58
+ let result = await this.git(options);
59
+ this.Logger.reset(result);
60
+ } catch (e) {
61
+ this.Logger.red(e.message);
62
+ }
63
+ await this.prompt.run();
64
+ }
65
+ }
66
+
67
+ module.exports = Git;
@@ -449,6 +449,16 @@ class Import extends require("../Command") {
449
449
  }
450
450
  try {
451
451
  this.validate(options);
452
+
453
+ // Check for git conflicts before importing files (skip if help or simulate)
454
+ if (!options.help && !options.simulate) {
455
+ const shouldProceed = await this.checkGitConflictsBeforeOperation();
456
+ if (!shouldProceed) {
457
+ await this.prompt.run();
458
+ return;
459
+ }
460
+ }
461
+
452
462
  if (options.expand) {
453
463
  await this.expand(options);
454
464
  } else {
@@ -48,6 +48,16 @@ class Mkdir extends require("../Command") {
48
48
  try {
49
49
  this.validate(options);
50
50
  this.checkPath(options);
51
+
52
+ // Check for git conflicts before creating directories
53
+ if (!options.help) {
54
+ const shouldProceed = await this.checkGitConflictsBeforeOperation();
55
+ if (!shouldProceed) {
56
+ await this.prompt.run();
57
+ return;
58
+ }
59
+ }
60
+
51
61
  let data = await this.internalFs.getTreeIndexAndPath(options.path);
52
62
  let sanitizedPath = Entry.sanitizePath(data.path);
53
63
  if (sanitizedPath !== data.path) {
@@ -147,6 +147,16 @@ class Mv extends require("../Command") {
147
147
  }
148
148
  try {
149
149
  this.validate(options);
150
+
151
+ // Check for git conflicts before moving/renaming files
152
+ if (!options.help) {
153
+ const shouldProceed = await this.checkGitConflictsBeforeOperation();
154
+ if (!shouldProceed) {
155
+ await this.prompt.run();
156
+ return;
157
+ }
158
+ }
159
+
150
160
  if (options.find) {
151
161
  options.newPath = options.destination;
152
162
  options.path = options.find;
@@ -122,6 +122,16 @@ class Paste extends require("../Command") {
122
122
  }
123
123
  try {
124
124
  this.validate(options);
125
+
126
+ // Check for git conflicts before pasting content
127
+ if (!options.help) {
128
+ const shouldProceed = await this.checkGitConflictsBeforeOperation();
129
+ if (!shouldProceed) {
130
+ await this.prompt.run();
131
+ return;
132
+ }
133
+ }
134
+
125
135
  let name = await this.paste(options);
126
136
  this.Logger.grey("Pasted the clipboard to:");
127
137
  this.Logger.reset(name);
@@ -117,6 +117,16 @@ class Rm extends require("../Command") {
117
117
  } else {
118
118
  try {
119
119
  this.validate(options);
120
+
121
+ // Check for git conflicts before removing files
122
+ if (!options.help) {
123
+ const shouldProceed = await this.checkGitConflictsBeforeOperation();
124
+ if (!shouldProceed) {
125
+ await this.prompt.run();
126
+ return;
127
+ }
128
+ }
129
+
120
130
  let deleted = await this.rm(options);
121
131
  if (deleted.length === 0) {
122
132
  this.Logger.grey("No files have been deleted.");
@@ -196,6 +196,16 @@ class Tag extends require("../Command") {
196
196
  }
197
197
  try {
198
198
  this.validate(options);
199
+
200
+ // Check for git conflicts before adding/removing tags
201
+ if (options.add || options.remove) {
202
+ const shouldProceed = await this.checkGitConflictsBeforeOperation();
203
+ if (!shouldProceed) {
204
+ await this.prompt.run();
205
+ return;
206
+ }
207
+ }
208
+
199
209
  let result = await this.tag(options);
200
210
  if (options.list) {
201
211
  if (options.global) {
@@ -293,6 +293,16 @@ class Totp extends require("../Command") {
293
293
  }
294
294
  try {
295
295
  this.validate(options);
296
+
297
+ // Check for git conflicts before setting TOTP secrets
298
+ if (options.set || options.fromClipboard || options.fromImage) {
299
+ const shouldProceed = await this.checkGitConflictsBeforeOperation();
300
+ if (!shouldProceed) {
301
+ await this.prompt.run();
302
+ return;
303
+ }
304
+ }
305
+
296
306
  let token = await this.totp(options);
297
307
  if (options.fromImage || options.fromClipboard) {
298
308
  this.Logger.grey(token);
@@ -179,6 +179,15 @@ class Touch extends require("../Command") {
179
179
  try {
180
180
  this.validate(options);
181
181
  this.checkPath(options);
182
+
183
+ // Check for git conflicts before creating/modifying files
184
+ if (!options.help) {
185
+ const shouldProceed = await this.checkGitConflictsBeforeOperation();
186
+ if (!shouldProceed) {
187
+ await this.prompt.run();
188
+ return;
189
+ }
190
+ }
182
191
  /* istanbul ignore if */
183
192
  if (!options.generateWallet) {
184
193
  if (options.notVisibleContent) {
@@ -75,6 +75,16 @@ class Use extends require("../Command") {
75
75
  }
76
76
  try {
77
77
  this.validate(options);
78
+
79
+ // Check for git conflicts before creating new datasets
80
+ if (options.create) {
81
+ const shouldProceed = await this.checkGitConflictsBeforeOperation();
82
+ if (!shouldProceed) {
83
+ await this.prompt.run();
84
+ return;
85
+ }
86
+ }
87
+
78
88
  let result = await this.use(options);
79
89
  if (result) {
80
90
  this.Logger.reset(result);