@harness-engineering/cli 2.2.0 → 2.2.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.
@@ -33,7 +33,7 @@ function main() {
33
33
  process.exit(0);
34
34
  }
35
35
 
36
- if (/--no-verify/.test(command) || /\bgit\b.*\bcommit\b.*\s-n\b/.test(command)) {
36
+ if (containsHookBypass(command)) {
37
37
  process.stderr.write(
38
38
  'BLOCKED: --no-verify flag detected. Hooks must not be bypassed.\n'
39
39
  );
@@ -47,4 +47,22 @@ function main() {
47
47
  }
48
48
  }
49
49
 
50
+ // Strip heredoc bodies, quoted strings, and shell comments so flag detection
51
+ // runs against argv tokens only — not text the user is just talking about.
52
+ function stripStringsAndComments(cmd) {
53
+ let s = cmd;
54
+ s = s.replace(/<<-?\s*['"]?(\w+)['"]?[\s\S]*?\n\s*\1\b/g, ' ');
55
+ s = s.replace(/'[^']*'/g, ' ');
56
+ s = s.replace(/"(?:[^"\\]|\\.)*"/g, ' ');
57
+ s = s.replace(/(^|[\s;&|`(])#[^\n]*/g, '$1');
58
+ return s;
59
+ }
60
+
61
+ function containsHookBypass(command) {
62
+ const stripped = stripStringsAndComments(command);
63
+ if (/(?:^|\s)--no-verify(?=\s|$)/.test(stripped)) return true;
64
+ if (/\bgit\s+(?:[\w-]+\s+)*?commit\b[^\n]*?(?:^|\s)-n(?=\s|$)/.test(stripped)) return true;
65
+ return false;
66
+ }
67
+
50
68
  main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harness-engineering/cli",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "CLI for Harness Engineering toolkit",
5
5
  "type": "module",
6
6
  "bin": {
@@ -39,10 +39,10 @@
39
39
  "yaml": "^2.8.3",
40
40
  "zod": "^3.25.76",
41
41
  "@harness-engineering/core": "0.23.8",
42
- "@harness-engineering/dashboard": "0.5.2",
43
42
  "@harness-engineering/graph": "0.8.0",
44
- "@harness-engineering/orchestrator": "0.3.2",
45
43
  "@harness-engineering/linter-gen": "0.1.7",
44
+ "@harness-engineering/orchestrator": "0.3.2",
45
+ "@harness-engineering/dashboard": "0.5.2",
46
46
  "@harness-engineering/types": "0.11.0"
47
47
  },
48
48
  "peerDependencies": {