Skip to content

fix(deps): declare tslib as a runtime dependency - #287

Merged
Harshi-Shah-CS merged 10 commits into
developmentfrom
CL-8765
Nov 17, 2026
Merged

Harshi-Shah-CS merged 10 commits into
developmentfrom
CL-8765

Conversation

@Harshi-Shah-CS

Copy link
Copy Markdown
Contributor

Jira: https://contentstack.atlassian.net/browse/CL-8765
Fixes #194

Stacked on #286. Until that merges this PR also shows its three commits; review only the last one, fix(deps): declare tslib as a runtime dependency.

What

  • tslib moves from devDependencies to dependencies. tsconfig sets importHelpers, so the compiled commands require("tslib"), but csdx skips devDependencies when it installs the plugin. On strict installs (pnpm) every launch command fails with Cannot find module 'tslib'.
  • Removes the dead @oclif/plugin-plugins entry from oclif.plugins. Its dependency was removed in 5662149, so oclif already skipped it; help output and the generated manifest are identical without it.
  • Ports the dependency guard test from v2-dev (dc69e11). It fails on any package the compiled runtime requires, or any oclif.plugins entry, that isn't a production dependency.

Tests

  • Strict install of the packed CLI (--omit=dev --install-strategy=linked): before, launch, launch:deployments, launch:logs and launch:open all fail with MODULE_NOT_FOUND tslib; after, all load
  • The guard test fails against the old package.json and passes now
  • npm test: unit + Jest 140 passed, integration 33 passed

csdx 1.x depends on cli-launch ^1.11.3, so a 1.11.5 patch reaches csdx users without a CLI release.

#claude_code#
🤖 Generated with Claude Code

Harshi-Shah-CS and others added 4 commits November 16, 2026 16:56
The next commit changes both files, and lint-staged runs eslint --fix on
every staged file, so their existing errors would block it.

eslint --fix: indentation, quote style, let to const, Array<T> to T[].
By hand: drop an unused catch parameter, wrap two JSDoc lines, and add
eslint-disable-next-line for long user-facing strings, one URL and the
require() of the user's config file, so none of that text or behaviour
changes. No functional change.

.talismanrc gets a checksum entry for base-class.ts: Talisman flags the
moved "key" type annotations (parseEnvVariablesString, envKeys) as
potential secrets; they are not.

#claude_code#
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
…indings

open@8.4.2 (SNYK-JS-OPEN-22112123, High) is fixed only in open 11, which
is ESM-only. The CLI compiles to CommonJS, where TypeScript turns import()
into require(), so the three browser-open call sites now go through
util/open-url.ts, which loads open with a native dynamic import. The
GitHub-connect step and launch:open await it, so the process cannot exit
before the browser starts; the delayed deployment-URL open keeps its
fire-and-forget timer. Opening the browser stays best effort: open 11
rejects when the launcher fails, and every caller prints the URL first,
so openUrl swallows that instead of failing the command (or crashing
with an unhandled rejection after a successful deploy).

@oclif/core moves from 4.11.14 to 4.14.0 within the existing ^4.2.7 range
(lockfile only). 4.14 uses ejs 6, which drops the ejs > jake > filelist >
minimatch@5.1.9 path behind SNYK-JS-MINIMATCH-22111072. An override pins
@oclif/core's own minimatch to ^11.0.1, as on v2-dev.

Two findings remain reported, not ignored. Neither has an upgrade, so
neither fails --fail-on=all: adm-zip@0.6.1 (SNYK-JS-ADMZIP-21707815), and
open@8.4.2 pulled in by @contentstack/cli-utilities, whose latest release
(2.0.2) still depends on open ^8.4.2.

Integration tests now mock util/open-url instead of open, and stub
@oclif/core's getPlatform, which 4.14 implements with a native
import('wsl-utils') that Jest's VM cannot run.

.talismanrc: base-class.ts checksum refreshed for its new content.

#claude_code#
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
…un from a hook

Git exports GIT_DIR and the other repo-local variables to hooks, and the
pre-push hook runs npm test. With them set, the harness's git init,
config, commit and remote add in its temp projects acted on this
repository: a push from a worktree left "initial commit" commits on the
branch and set user.name, user.email, commit.gpgsign and core.bare in the
shared .git/config.

jest.global-setup.ts now clears the variables `git rev-parse
--local-env-vars` lists. It runs in Jest's parent process, so the child
processes the harness and the CLI spawn inherit the clean environment
(setupFiles only change the sandbox's copy of process.env).

#claude_code#
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
tsconfig sets importHelpers, so the compiled commands require tslib at
runtime, but it was declared only as a devDependency. When csdx installs
@contentstack/cli-launch as a plugin it skips devDependencies, so a strict
install (pnpm) fails every launch command with "Cannot find module
'tslib'" (#194). Default npm installs only survived because tslib was
hoisted from another package.

Also drop @oclif/plugin-plugins from oclif.plugins. Its dependency was
removed in February, so oclif already skipped the entry; help output and
the generated manifest are unchanged without it.

Add the dependency guard test from v2-dev (dc69e11). It compiles every
runtime source with the project's compiler options and fails on any
required package, or oclif.plugins entry, that is not a production
dependency.

#claude_code#
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@Harshi-Shah-CS
Harshi-Shah-CS requested a review from a team as a code owner November 16, 2026 14:17
@snyk-io

snyk-io Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 2 2 25 ✅ Passed
🟡 Medium Severity 0 1 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 2
  • Medium without fixes: 1
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

@dhruv-parekh-cs dhruv-parekh-cs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the whole PR (6bd5f3f); this branch carries #286's three commits, so the findings below are posted on #286 and are still open here too:

  • Low src/util/open-url.ts:5: new Function runs at module load outside the try; --disallow-code-generation-from-strings crashes every deploy command.
  • Low src/util/open-url.ts:3: new code comments against AGENTS.md.
  • Low src/util/open-url.test.ts:6: openUrl's success path is untested.
  • Low test/integration/jest.setup.ts:1: AGENTS.md's harness section is now wrong.
  • Low package-lock.json:3449: npm 10 regeneration dropped the libc fields 6fc6af1 restored.
  • Low package.json:26: @oclif/core range not raised to ^4.14.0.

Stack: #287's base is development, not #286's branch, so merge #286 first (or retarget this PR) to keep its diff to its own commit.

Not approved: 7 low findings open (more than 3).

— 🤖 launch-pr-review-agent (Claude)


Generated by Claude Code

Harshi-Shah-CS and others added 3 commits November 16, 2026 20:26
- open-url.ts: create the dynamic importer lazily inside openUrl's try.
  Built at module load, new Function threw EvalError under
  --disallow-code-generation-from-strings, so every command importing the
  helper crashed instead of just not opening a browser.
- openUrl takes an optional loader, and the tests inject a fake open to
  cover the success path (called with the URL) plus both failure paths,
  instead of relying on Jest's VM rejecting the native import.
- Drop the code comments added in this PR (AGENTS.md: no code comments);
  the rationale lives in the commit messages and the PR description.
- AGENTS.md: the integration harness now replaces src/util/open-url and
  @oclif/core's getPlatform rather than the open package, and
  jest.global-setup.ts clears git's repo-local env vars.
- @oclif/core range raised to ^4.14.0 so installs cannot keep a 4.11.x
  that still carries the flagged minimatch path.
- package-lock.json: restore the 23 "libc" fields npm 10 dropped, copied
  from development for the same package versions. npm 11 (release CI)
  re-resolves the file without changes.

#claude_code#
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
…guard

The guard only matched double-quoted require("x"). TypeScript emits a
dynamic import('x') as require('x') with single quotes, and the open
helper builds import("open") inside a string passed to new Function, so
an undeclared package pulled in either way passed the guard and then
failed at runtime. It now matches require(...) and import(...) with
either quote style, and asserts that open is detected.

#claude_code#
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 2 2 25 ✅ Passed
🟡 Medium Severity 0 1 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 2
  • Medium without fixes: 1
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

@Harshi-Shah-CS

Copy link
Copy Markdown
Contributor Author

/ship 2b summary (re: @dhruv-parekh-cs's review of 6bd5f3f):

Left for human: none. Checks: npm test passes (unit + Jest 142, integration 33).

Next: needs re-approval. Still stacked on #286, so merge #286 first.

@dhruv-parekh-cs dhruv-parekh-cs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review since 6bd5f3f (081d551 from #286, the merge, and c5ec03c).

The dependency guard fix in c5ec03c addresses the earlier finding. The earlier findings carried from #286 are fixed here too.

This branch carries #286's new commit, so these 2 lows posted inline on #286 are also open here:

  • Low AGENTS.md:24: the "... all run for real" sentence got joined onto the git-env bullet.
  • Low src/util/open-url.test.ts:25: the failure-path tests skip the happy path's assertions (AGENTS.md testing rule).

Stack: #287's base is still development, so merge #286 first (or retarget this PR).

Approved: no high or medium finding is open, and 2 lows are open (the limit is 3).

— 🤖 launch-pr-review-agent (Claude)


Generated by Claude Code

Harshi-Shah-CS and others added 2 commits November 17, 2026 10:59
- AGENTS.md: the "all run for real" sentence had been joined onto the
  new git-env bullet; it closes the "Only these are replaced" bullet
  again, so the harness contract reads as before.
- open-url.test.ts: the failure-path tests now keep the happy path's
  assertions (AGENTS.md: do not skip assertions in edge-case tests). The
  load-failure test checks the loader was called; the open-failure test
  checks open was called with the URL.

#claude_code#
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@Harshi-Shah-CS

Copy link
Copy Markdown
Contributor Author

@dhruv-parekh-cs re: your review of 7835923's predecessor: the two #286 Lows carried here (AGENTS.md:24 sentence placement, failure-path assertions in open-url.test.ts) are fixed in #286's ccdb47a, merged into this branch as 7835923. Agreed on the stack: #286 merges first, then this PR gets rebased onto development.

@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 2 2 25 ✅ Passed
🟡 Medium Severity 0 1 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 2
  • Medium without fixes: 1
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

@Harshi-Shah-CS

Copy link
Copy Markdown
Contributor Author

#286 is merged (080cd70), and development is merged into this branch (9feebe8), so the diff now holds only this PR's change: tslib as a runtime dependency, the dead @oclif/plugin-plugins entry removed, and the dependency guard test. npm test passes (unit + Jest 142, integration 33).

@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 2 2 25 ✅ Passed
🟡 Medium Severity 0 1 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 2
  • Medium without fixes: 1
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

@dhruv-parekh-cs dhruv-parekh-cs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review since c5ec03c (merges of #286 and development; the new content is ccdb47a).

The 2 lows carried from #286 (the AGENTS.md "run for real" sentence and the edge-case test assertions) are fixed here now. With #286 merged, this PR's diff against development is its own commit only.

No new findings. Approved.

— 🤖 launch-pr-review-agent (Claude)


Generated by Claude Code

@Harshi-Shah-CS
Harshi-Shah-CS merged commit f6f7503 into development Nov 17, 2026
7 checks passed
@Harshi-Shah-CS
Harshi-Shah-CS deleted the CL-8765 branch November 17, 2026 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

⌂ Proxy