feat: add load-chalk hook to initialize chalk for CLI commands#135
feat: add load-chalk hook to initialize chalk for CLI commands#135harshitha-cstk wants to merge 3 commits into
Conversation
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ 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:
✅ BUILD PASSED - All security checks passed |
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ 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:
✅ BUILD PASSED - All security checks passed |
…CLI initialization" This reverts commit 8aa85fd.
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ 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:
✅ BUILD PASSED - All security checks passed |
Summary
Resolves Chalk not loaded. Ensure loadChalk() is called during init when running stack export / import (and similar flows) under pnpm, where the core CLI and a registry plugin can each resolve a different physical copy of @contentstack/cli-utilities at the same version. loadChalk() ran on one copy (core utils-init); getChalk() ran on the other (plugin), so the plugin’s module never had chalk initialized.
Changes
@contentstack/cli-utilities (chalk.ts)
Keep loadChalk() / getChalk() as the public API (no changes required in other packages).
Store the loaded chalk module on globalThis using Symbol.for('@contentstack/cli-utilities/chalk') so every copy of this package in the process shares one cache after loadChalk() runs once (e.g. from core utils-init).
Use local variable name chalkInstance throughout for clarity and consistency with the previous module-scoped pattern.