@freshworks/shiftleft-tools 1.1.8 → 1.1.10

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": "@freshworks/shiftleft-tools",
3
- "version": "1.1.8",
3
+ "version": "1.1.10",
4
4
  "description": "CLI for managing Cursor rules/skills and Postman test infrastructure across Java Spring Boot and Node.js/Express projects",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -2,6 +2,7 @@ import {
2
2
  existsSync,
3
3
  lstatSync,
4
4
  rmSync,
5
+ unlinkSync,
5
6
  symlinkSync,
6
7
  statSync,
7
8
  readdirSync,
@@ -43,11 +44,20 @@ function cursorRuleLinks(stack) {
43
44
  }
44
45
 
45
46
  function removeExisting(p) {
47
+ let st;
46
48
  try {
47
- lstatSync(p); // throws if absent
48
- rmSync(p, { recursive: true, force: true });
49
+ st = lstatSync(p); // throws if absent
49
50
  } catch {
50
- /* nothing there */
51
+ return; // nothing there
52
+ }
53
+ // unlink symlinks (incl. dangling) and plain files; only recurse for real
54
+ // dirs. rmSync({recursive,force}) silently no-ops on a dangling symlink
55
+ // (force swallows the ENOENT from following the dead link), leaving it in
56
+ // place — so a later mkdir/write follows it and fails with ENOENT.
57
+ if (st.isSymbolicLink() || !st.isDirectory()) {
58
+ unlinkSync(p);
59
+ } else {
60
+ rmSync(p, { recursive: true, force: true });
51
61
  }
52
62
  }
53
63
 
@@ -399,20 +399,15 @@ def updateShiftLeftStatus(String state, String targetUrlPath = '') {
399
399
 
400
400
  // Ensure the shiftleft CLI is installed. run-all.sh execs `shiftleft test`,
401
401
  // which stages the library scripts from the package — so CI agents need the CLI.
402
- // Idempotent (skips if already present). Requires a Jenkins "Secret text"
403
- // credential (id below) holding the Nexus npm basic-auth token, i.e. the value
404
- // for //nexuscentral.runwayci.com/repository/npm-group/:_auth= (base64 of user:pass).
402
+ // Idempotent (skips if already present). Installs the public package from npmjs;
403
+ // CI agents need outbound access to registry.npmjs.org.
405
404
  def ensureShiftleftCli() {
406
- withCredentials([string(credentialsId: 'nexus-npm-auth', variable: 'NEXUS_NPM_AUTH')]) {
407
- sh '''#!/bin/bash --login
408
- set -e
409
- if ! command -v shiftleft >/dev/null 2>&1; then
410
- echo "//nexuscentral.runwayci.com/repository/npm-group/:_auth=${NEXUS_NPM_AUTH}" >> "$HOME/.npmrc"
411
- npm install -g shiftleft-tools \
412
- --registry=https://nexuscentral.runwayci.com/repository/npm-group/ --prefer-online
413
- fi
414
- '''
415
- }
405
+ sh '''#!/bin/bash --login
406
+ set -e
407
+ if ! command -v shiftleft >/dev/null 2>&1; then
408
+ npm install -g @freshworks/shiftleft-tools
409
+ fi
410
+ '''
416
411
  }
417
412
 
418
413
  def runMutationTests() {
@@ -209,20 +209,15 @@ pipeline {
209
209
  */
210
210
  // Ensure the shiftleft CLI is installed. `shiftleft stage-scripts` / run-all.sh
211
211
  // (which execs `shiftleft test`) stage the library scripts from the package, so
212
- // CI agents need the CLI. Idempotent. Requires a Jenkins "Secret text" credential
213
- // (id below) holding the Nexus npm basic-auth token, i.e. the value for
214
- // //nexuscentral.runwayci.com/repository/npm-group/:_auth= (base64 of user:pass).
212
+ // CI agents need the CLI. Idempotent. Installs the public package from npmjs;
213
+ // CI agents need outbound access to registry.npmjs.org.
215
214
  def ensureShiftleftCli() {
216
- withCredentials([string(credentialsId: 'nexus-npm-auth', variable: 'NEXUS_NPM_AUTH')]) {
217
- sh '''#!/bin/bash --login
218
- set -e
219
- if ! command -v shiftleft >/dev/null 2>&1; then
220
- echo "//nexuscentral.runwayci.com/repository/npm-group/:_auth=${NEXUS_NPM_AUTH}" >> "$HOME/.npmrc"
221
- npm install -g shiftleft-tools \
222
- --registry=https://nexuscentral.runwayci.com/repository/npm-group/ --prefer-online
223
- fi
224
- '''
225
- }
215
+ sh '''#!/bin/bash --login
216
+ set -e
217
+ if ! command -v shiftleft >/dev/null 2>&1; then
218
+ npm install -g @freshworks/shiftleft-tools
219
+ fi
220
+ '''
226
221
  }
227
222
 
228
223
  def runShiftLeftStagingPostman() {
@@ -1,15 +1,16 @@
1
1
  #!/usr/bin/env bash
2
2
  # Generated by shiftleft-tools — do not edit.
3
3
  #
4
- # Test orchestration lives in the shiftleft-tools package, not in this repo. This
5
- # shim stages the latest scripts (gitignored, machine-local) and runs them, so
6
- # `npm install -g shiftleft-tools` updates behavior with no repo change.
4
+ # Test orchestration lives in the @freshworks/shiftleft-tools package, not in this
5
+ # repo. This shim stages the latest scripts (gitignored, machine-local) and runs
6
+ # them, so `npm install -g @freshworks/shiftleft-tools` updates behavior with no
7
+ # repo change.
7
8
  # All flags pass through unchanged: --env, --skip-unit, --skip-mutation,
8
9
  # --skip-postman, --skip-coverage, --skip-report, --no-delay, ...
9
10
 
10
11
  if ! command -v shiftleft >/dev/null 2>&1; then
11
12
  echo "error: shiftleft CLI not found." >&2
12
- echo "Install it with: npm install -g shiftleft-tools --registry=https://nexuscentral.runwayci.com/repository/npm-group/" >&2
13
+ echo "Install it with: npm install -g @freshworks/shiftleft-tools" >&2
13
14
  exit 127
14
15
  fi
15
16
 
@@ -8,7 +8,7 @@ Language-agnostic standards for writing and organizing Postman integration tests
8
8
 
9
9
  The pipeline's library scripts (`postman/scripts/lib/`, `runners/`,
10
10
  `report-generators/`, `auth/`, `infra/`, `database/`) are **not** vendored into
11
- the repo. They live in the installed `shiftleft-tools` package and are pulled in
11
+ the repo. They live in the installed `@freshworks/shiftleft-tools` package and are pulled in
12
12
  on demand:
13
13
 
14
14
  - `shiftleft test` (and the committed `postman/scripts/run-all.sh` shim) stage the
@@ -22,14 +22,14 @@ Before writing any code, check these canonical repos. They are the ground truth
22
22
  - `mp-installation` — PIT mutation, JaCoCo, multi-product Postman, API coverage matrix, quality report, Jenkins ShiftLeft
23
23
  - `dp-apps` — same stack, original reference
24
24
 
25
- **Script source (the `shiftleft-tools` package — pulled at runtime):**
25
+ **Script source (the `@freshworks/shiftleft-tools` package — pulled at runtime):**
26
26
  ```bash
27
27
  # Stage the latest library scripts from the installed package into postman/scripts/.
28
28
  # Gitignored and refreshed on every run — never copy or commit them by hand.
29
29
  shiftleft stage-scripts
30
30
  ```
31
31
 
32
- The library scripts live only in the `shiftleft-tools` package. `shiftleft stage-scripts`
32
+ The library scripts live only in the `@freshworks/shiftleft-tools` package. `shiftleft stage-scripts`
33
33
  (and `shiftleft test`, which stages then runs) pulls the current versions in — do
34
34
  not copy from a templates directory or write them from scratch.
35
35
 
@@ -171,7 +171,7 @@ I will make the following targeted changes:
171
171
  5. Add missing stage-report-artifacts.sh
172
172
  6. Add missing generate-quality-report.sh
173
173
  7. Add missing runners/run-tests-local.sh and runners/run-tests-staging.sh
174
- 8. Copy all lib/report_*.py modules and lib/api_coverage.py from shiftleft-tools templates
174
+ 8. Copy all lib/report_*.py modules and lib/api_coverage.py from @freshworks/shiftleft-tools templates
175
175
  9. Update Jenkinsfile ShiftLeft stage to add quality report generation
176
176
 
177
177
  I will NOT change:
@@ -235,7 +235,7 @@ Update `targetClasses` and `targetTests` with the actual package paths found.
235
235
 
236
236
  **Issue: missing pitest-junit5-plugin** — add to PIT plugin dependencies.
237
237
 
238
- ### 4.3 Refresh scripts from the shiftleft-tools package
238
+ ### 4.3 Refresh scripts from the @freshworks/@freshworks/shiftleft-tools package
239
239
 
240
240
  Run `shiftleft stage-scripts` — it re-stages every library script from the
241
241
  installed package, so stale or missing ones are replaced automatically. You do
@@ -282,7 +282,7 @@ withCredentials([string(credentialsId: 'github-token', variable: 'GH_TOKEN')]) {
282
282
 
283
283
  **Static AWS keys in Jenkins env** — remove `AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY` from `environment {}`. Use IRSA (pod IAM role annotation on the pod spec). The pod supplies credentials automatically via the metadata service — no env vars needed.
284
284
 
285
- ### 4.3 Refresh scripts from the shiftleft-tools package
285
+ ### 4.3 Refresh scripts from the @freshworks/@freshworks/shiftleft-tools package
286
286
 
287
287
  Run `shiftleft stage-scripts` — it pulls every library script from the installed
288
288
  package into `postman/scripts/` (gitignored, made executable, refreshed on every
@@ -332,7 +332,7 @@ module.exports = {
332
332
  }
333
333
  ```
334
334
 
335
- ### 4.4 Stage run-mutation-tests.sh from the shiftleft-tools package
335
+ ### 4.4 Stage run-mutation-tests.sh from the @freshworks/@freshworks/shiftleft-tools package
336
336
 
337
337
  `runners/run-mutation-tests.sh` and `lib/cleanup-stryker.sh` are library scripts —
338
338
  they're staged from the installed package, not copied by hand. Run:
@@ -22,7 +22,7 @@ Before writing any code, check these canonical repos. They are the ground truth
22
22
  - `mp-installation` — PIT mutation, JaCoCo, multi-product Postman, API coverage matrix, quality report, Jenkins ShiftLeft
23
23
  - `dp-apps` — same stack, original reference
24
24
 
25
- **Script source (the `shiftleft-tools` package — pulled at runtime):**
25
+ **Script source (the `@freshworks/shiftleft-tools` package — pulled at runtime):**
26
26
  ```bash
27
27
  # Stage the latest library scripts from the installed package into postman/scripts/.
28
28
  # These are gitignored and refreshed on every run — never copy or commit them by hand.
@@ -31,7 +31,7 @@ shiftleft stage-scripts
31
31
 
32
32
  Do not copy scripts from a templates directory or write them from scratch. The
33
33
  library scripts (`runners/`, `report-generators/`, `lib/`, `auth/`, `infra/`,
34
- `database/`) live only in the `shiftleft-tools` package; `shiftleft stage-scripts`
34
+ `database/`) live only in the `@freshworks/shiftleft-tools` package; `shiftleft stage-scripts`
35
35
  (and `shiftleft test`, which stages then runs) pulls the current versions in.
36
36
 
37
37
  ---
@@ -141,7 +141,7 @@ I will set up the following components in order:
141
141
  1. [if missing] Postman infrastructure (collections, scripts, config)
142
142
  2. [if missing] JaCoCo coverage plugin in pom.xml
143
143
  3. [if missing] PIT mutation testing (profile-gated, discover packages first)
144
- 4. Stage library scripts from the shiftleft-tools package (`shiftleft stage-scripts`):
144
+ 4. Stage library scripts from the @freshworks/@freshworks/shiftleft-tools package (`shiftleft stage-scripts`):
145
145
  postman/scripts/run-all.sh
146
146
  postman/scripts/report-generators/mutation-report.sh
147
147
  postman/scripts/report-generators/java-api-coverage-matrix.sh
@@ -217,7 +217,7 @@ Key requirements:
217
217
  - XML + HTML output — XML required for quality report script
218
218
  - Mutation threshold: 60%, coverage threshold: 70%
219
219
 
220
- ### Step D: Stage scripts from the shiftleft-tools package
220
+ ### Step D: Stage scripts from the @freshworks/@freshworks/shiftleft-tools package
221
221
 
222
222
  **Do not copy or write these by hand.** Run `shiftleft stage-scripts` to pull the
223
223
  current library scripts from the installed package into `postman/scripts/` (they
@@ -122,7 +122,7 @@ I will set up the following components in order:
122
122
  1. [if missing] Postman infrastructure (collections, scripts, config)
123
123
  2. [if missing] nyc coverage in package.json
124
124
  3. [if missing] Stryker mutation testing (discover actual src structure first)
125
- 4. Stage library scripts from the shiftleft-tools package (`shiftleft stage-scripts`):
125
+ 4. Stage library scripts from the @freshworks/@freshworks/shiftleft-tools package (`shiftleft stage-scripts`):
126
126
  run-all.sh, runners/run-mutation-tests.sh,
127
127
  report-generators/node-api-coverage-matrix.sh, generate-consolidated-report.sh,
128
128
  report-generators/stage-report-artifacts.sh,
@@ -196,7 +196,7 @@ Key requirements:
196
196
  - `htmlReporter: { fileName: 'coverage/mutation/index.html' }`
197
197
  - `run-mutation-tests.sh` for the two-mode approach (since vs full)
198
198
 
199
- ### Step D: Stage scripts from the shiftleft-tools package
199
+ ### Step D: Stage scripts from the @freshworks/@freshworks/shiftleft-tools package
200
200
 
201
201
  Run `shiftleft stage-scripts` to pull the library scripts from the installed
202
202
  package into `postman/scripts/` — do not copy or write them by hand. They are