@hubspot/cli 7.11.3 → 7.11.4

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/bin/cli.js CHANGED
@@ -10,6 +10,7 @@ import { checkAndWarnGitInclusionMiddleware } from '../lib/middleware/gitMiddlew
10
10
  import { performChecks } from '../lib/middleware/yargsChecksMiddleware.js';
11
11
  import { setRequestHeaders } from '../lib/middleware/requestMiddleware.js';
12
12
  import { checkFireAlarms } from '../lib/middleware/fireAlarmMiddleware.js';
13
+ import { checkDeprecationWarning } from '../lib/middleware/deprecationWarningMiddleware.js';
13
14
  import removeCommand from '../commands/remove.js';
14
15
  import initCommand from '../commands/init.js';
15
16
  import logsCommand from '../commands/logs.js';
@@ -74,6 +75,7 @@ const argv = yargs(process.argv.slice(2))
74
75
  injectAccountIdMiddleware,
75
76
  validateConfigMiddleware,
76
77
  autoUpdateCLI,
78
+ checkDeprecationWarning,
77
79
  checkAndWarnGitInclusionMiddleware,
78
80
  validateAccountOptions,
79
81
  checkFireAlarms,
package/lang/en.d.ts CHANGED
@@ -2967,6 +2967,10 @@ export declare const lib: {
2967
2967
  notInstalledGlobally: string;
2968
2968
  updateFailed: (latestVersion: string) => string;
2969
2969
  };
2970
+ deprecationWarning: {
2971
+ deprecatedMessage: (currentVersion: string, eolDate: string) => string;
2972
+ endOfLifeMessage: (currentVersion: string, eolDate: string) => string;
2973
+ };
2970
2974
  };
2971
2975
  projectProfiles: {
2972
2976
  logs: {
package/lang/en.js CHANGED
@@ -6,7 +6,7 @@ import { ARCHIVED_HUBSPOT_CONFIG_YAML_FILE_NAME, GLOBAL_CONFIG_PATH, DEFAULT_HUB
6
6
  import { uiAccountDescription, uiBetaTag, uiCommandReference, uiLink, UI_COLORS, uiAuthCommandReference, } from '../lib/ui/index.js';
7
7
  import { getProjectDetailUrl, getProjectSettingsUrl, getLocalDevUiUrl, } from '../lib/projects/urls.js';
8
8
  import { getProductUpdatesUrl } from '../lib/links.js';
9
- import { APP_DISTRIBUTION_TYPES, APP_AUTH_TYPES, PROJECT_CONFIG_FILE, PROJECT_WITH_APP, LEGACY_PUBLIC_APP_FILE, } from '../lib/constants.js';
9
+ import { APP_DISTRIBUTION_TYPES, APP_AUTH_TYPES, PROJECT_CONFIG_FILE, PROJECT_WITH_APP, LEGACY_PUBLIC_APP_FILE, CLI_SUPPORT_GUIDELINES_URL, } from '../lib/constants.js';
10
10
  export const commands = {
11
11
  generalErrors: {
12
12
  srcIsProject: (src, command) => `"${src}" is in a project folder. Did you mean "hs project ${command}"?`,
@@ -2989,6 +2989,20 @@ export const lib = {
2989
2989
  notInstalledGlobally: 'Cannot auto-update the HubSpot CLI because NPM is not installed globally',
2990
2990
  updateFailed: (latestVersion) => `Failed to update HubSpot CLI to version ${chalk.bold(latestVersion)}`,
2991
2991
  },
2992
+ deprecationWarning: {
2993
+ deprecatedMessage: (currentVersion, eolDate) => chalk.yellow(`${chalk.bold('DEPRECATION WARNING:')}\n\n` +
2994
+ `Version: HubSpot CLI v${currentVersion}\n\n` +
2995
+ `Status: Deprecated (End of Life: ${eolDate})\n\n` +
2996
+ `Action Required: Upgrade to the latest major version to continue receiving new features\n\n` +
2997
+ `Replacement: Run ${uiCommandReference('npm install -g @hubspot/cli@latest')} to upgrade\n\n` +
2998
+ `${uiLink('CLI Support Guidelines', CLI_SUPPORT_GUIDELINES_URL)}\n`),
2999
+ endOfLifeMessage: (currentVersion, eolDate) => chalk.yellow(`${chalk.bold('END OF LIFE WARNING:')}\n\n` +
3000
+ `Version: HubSpot CLI v${currentVersion}\n\n` +
3001
+ `Status: End of Life (as of ${eolDate})\n\n` +
3002
+ `Action Required: This version is no longer supported. Upgrade immediately to continue receiving updates\n\n` +
3003
+ `Replacement: Run ${uiCommandReference('npm install -g @hubspot/cli@latest')} to upgrade\n\n` +
3004
+ `${uiLink('CLI Support Guidelines', CLI_SUPPORT_GUIDELINES_URL)}\n`),
3005
+ },
2992
3006
  },
2993
3007
  projectProfiles: {
2994
3008
  logs: {
@@ -3,6 +3,11 @@ export declare const DEFAULT_PROJECT_TEMPLATE_BRANCH: "main";
3
3
  export declare const FEEDBACK_INTERVAL: 10;
4
4
  export declare const HUBSPOT_FOLDER: "@hubspot";
5
5
  export declare const MARKETPLACE_FOLDER: "@marketplace";
6
+ export declare const ONE_DAY_IN_MILLISECONDS: number;
7
+ export declare const CLI_DEPRECATED_MAJOR_VERSION = 7;
8
+ export declare const CLI_DEPRECATED_MAJOR_VERSION_DEPRECATION_DATE = "2026-09-02";
9
+ export declare const CLI_DEPRECATED_MAJOR_VERSION_EOL_DATE = "2027-03-01";
10
+ export declare const CLI_SUPPORT_GUIDELINES_URL: "https://developers.hubspot.com/docs/developer-tooling/local-development/hubspot-cli/version-support";
6
11
  export declare const DEFAULT_POLLING_DELAY = 2000;
7
12
  export declare const PROJECT_CONFIG_FILE: "hsproject.json";
8
13
  export declare const PROJECT_BUILD_STATES: {
package/lib/constants.js CHANGED
@@ -3,6 +3,15 @@ export const DEFAULT_PROJECT_TEMPLATE_BRANCH = 'main';
3
3
  export const FEEDBACK_INTERVAL = 10;
4
4
  export const HUBSPOT_FOLDER = '@hubspot';
5
5
  export const MARKETPLACE_FOLDER = '@marketplace';
6
+ export const ONE_DAY_IN_MILLISECONDS = 24 * 60 * 60 * 1000;
7
+ // The previous major CLI version, per the CLI Version Support & Deprecation
8
+ // Policy. Only 1 previous major version is supported at a time.
9
+ export const CLI_DEPRECATED_MAJOR_VERSION = 7;
10
+ // The date CLI_DEPRECATED_MAJOR_VERSION enters its Deprecation Phase
11
+ export const CLI_DEPRECATED_MAJOR_VERSION_DEPRECATION_DATE = '2026-09-02';
12
+ // The date CLI_DEPRECATED_MAJOR_VERSION reaches end of life
13
+ export const CLI_DEPRECATED_MAJOR_VERSION_EOL_DATE = '2027-03-01';
14
+ export const CLI_SUPPORT_GUIDELINES_URL = 'https://developers.hubspot.com/docs/developer-tooling/local-development/hubspot-cli/version-support';
6
15
  export const DEFAULT_POLLING_DELAY = 2000;
7
16
  export const PROJECT_CONFIG_FILE = 'hsproject.json';
8
17
  export const PROJECT_BUILD_STATES = {
@@ -0,0 +1,95 @@
1
+ import fs from 'fs';
2
+ import { checkDeprecationWarning } from '../deprecationWarningMiddleware.js';
3
+ import { uiLogger } from '../../ui/logger.js';
4
+ import { debugError } from '../../errorHandlers/index.js';
5
+ import { pkg } from '../../jsonLoader.js';
6
+ vi.mock('fs');
7
+ vi.mock('../../jsonLoader.js', () => ({
8
+ pkg: { name: '@hubspot/cli', version: '7.11.3' },
9
+ }));
10
+ vi.mock('../../ui/logger.js', () => ({
11
+ uiLogger: { log: vi.fn() },
12
+ }));
13
+ vi.mock('../../errorHandlers/index.js', () => ({
14
+ debugError: vi.fn(),
15
+ }));
16
+ const mockedReadFileSync = vi.mocked(fs.readFileSync);
17
+ const mockedWriteFileSync = vi.mocked(fs.writeFileSync);
18
+ const mockedMkdirSync = vi.mocked(fs.mkdirSync);
19
+ describe('lib/middleware/deprecationWarningMiddleware', () => {
20
+ describe('checkDeprecationWarning()', () => {
21
+ beforeEach(() => {
22
+ pkg.version = '7.11.3';
23
+ mockedReadFileSync.mockImplementation(() => {
24
+ throw new Error('ENOENT');
25
+ });
26
+ mockedWriteFileSync.mockImplementation(() => undefined);
27
+ mockedMkdirSync.mockImplementation(() => undefined);
28
+ // CLI_DEPRECATED_MAJOR_VERSION_DEPRECATION_DATE is 2026-09-02, EOL is 2027-03-01
29
+ vi.setSystemTime(new Date('2026-09-03T00:00:00Z'));
30
+ });
31
+ afterEach(() => {
32
+ vi.useRealTimers();
33
+ });
34
+ it('should log a deprecation warning when past the deprecation date but before the EOL date', () => {
35
+ checkDeprecationWarning();
36
+ expect(uiLogger.log).toHaveBeenCalledWith(expect.stringContaining('DEPRECATION WARNING'));
37
+ expect(mockedWriteFileSync).toHaveBeenCalledWith(expect.stringContaining('state.json'), expect.stringContaining('"lastDeprecationWarningShown": "2026-09-03'), 'utf-8');
38
+ });
39
+ it('should log an end-of-life warning when past the EOL date', () => {
40
+ vi.setSystemTime(new Date('2027-04-01T00:00:00Z'));
41
+ checkDeprecationWarning();
42
+ expect(uiLogger.log).toHaveBeenCalledWith(expect.stringContaining('END OF LIFE WARNING'));
43
+ expect(mockedWriteFileSync).toHaveBeenCalledWith(expect.stringContaining('state.json'), expect.stringContaining('"lastEndOfLifeWarningShown": "2027-04-01'), 'utf-8');
44
+ });
45
+ it('should not log a warning when the current major version is not the deprecated major version', () => {
46
+ pkg.version = '8.0.0';
47
+ checkDeprecationWarning();
48
+ expect(uiLogger.log).not.toHaveBeenCalled();
49
+ expect(mockedWriteFileSync).not.toHaveBeenCalled();
50
+ });
51
+ it('should not log a warning when before the deprecation date', () => {
52
+ vi.setSystemTime(new Date('2026-01-01T00:00:00Z'));
53
+ checkDeprecationWarning();
54
+ expect(uiLogger.log).not.toHaveBeenCalled();
55
+ expect(mockedWriteFileSync).not.toHaveBeenCalled();
56
+ });
57
+ it('should not log the deprecation warning when it has already been shown within the last day', () => {
58
+ mockedReadFileSync.mockReturnValue(JSON.stringify({
59
+ lastDeprecationWarningShown: new Date(Date.now() - 1000).toISOString(),
60
+ }));
61
+ checkDeprecationWarning();
62
+ expect(uiLogger.log).not.toHaveBeenCalled();
63
+ expect(mockedWriteFileSync).not.toHaveBeenCalled();
64
+ });
65
+ it('should not log the end-of-life warning when it has already been shown within the last day', () => {
66
+ vi.setSystemTime(new Date('2027-04-01T00:00:00Z'));
67
+ mockedReadFileSync.mockReturnValue(JSON.stringify({
68
+ lastEndOfLifeWarningShown: new Date(Date.now() - 1000).toISOString(),
69
+ }));
70
+ checkDeprecationWarning();
71
+ expect(uiLogger.log).not.toHaveBeenCalled();
72
+ expect(mockedWriteFileSync).not.toHaveBeenCalled();
73
+ });
74
+ it('should log the end-of-life warning even when the deprecation warning was already shown today', () => {
75
+ vi.setSystemTime(new Date('2027-04-01T00:00:00Z'));
76
+ mockedReadFileSync.mockReturnValue(JSON.stringify({
77
+ lastDeprecationWarningShown: new Date(Date.now() - 1000).toISOString(),
78
+ }));
79
+ checkDeprecationWarning();
80
+ expect(uiLogger.log).toHaveBeenCalledWith(expect.stringContaining('END OF LIFE WARNING'));
81
+ });
82
+ it('should preserve unrelated existing fields in state.json when writing', () => {
83
+ mockedReadFileSync.mockReturnValue(JSON.stringify({ mcpTotalToolCalls: 42 }));
84
+ checkDeprecationWarning();
85
+ expect(mockedWriteFileSync).toHaveBeenCalledWith(expect.stringContaining('state.json'), expect.stringContaining('"mcpTotalToolCalls": 42'), 'utf-8');
86
+ });
87
+ it('should not throw when writing the stored state fails', () => {
88
+ mockedWriteFileSync.mockImplementation(() => {
89
+ throw new Error('boom');
90
+ });
91
+ expect(() => checkDeprecationWarning()).not.toThrow();
92
+ expect(debugError).toHaveBeenCalled();
93
+ });
94
+ });
95
+ });
@@ -0,0 +1 @@
1
+ export declare function checkDeprecationWarning(): void;
@@ -0,0 +1,78 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import moment from 'moment';
4
+ import semver from 'semver';
5
+ import { STATE_FILE_PATH } from '@hubspot/local-dev-lib/constants/config';
6
+ import { pkg } from '../jsonLoader.js';
7
+ import { lib } from '../../lang/en.js';
8
+ import { uiLogger } from '../ui/logger.js';
9
+ import { debugError } from '../errorHandlers/index.js';
10
+ import { CLI_DEPRECATED_MAJOR_VERSION, CLI_DEPRECATED_MAJOR_VERSION_DEPRECATION_DATE, CLI_DEPRECATED_MAJOR_VERSION_EOL_DATE, ONE_DAY_IN_MILLISECONDS, } from '../constants.js';
11
+ const STATE_FLAGS_LAST_SHOWN = {
12
+ deprecated: 'lastDeprecationWarningShown',
13
+ endOfLife: 'lastEndOfLifeWarningShown',
14
+ };
15
+ // Reads state.json directly, bypassing local-dev-lib's getStateValue, whose
16
+ // typed HubSpotState shape doesn't include this field and would strip it out
17
+ function readStateFile() {
18
+ try {
19
+ const contents = fs.readFileSync(STATE_FILE_PATH, 'utf-8');
20
+ const parsed = JSON.parse(contents);
21
+ if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
22
+ return parsed;
23
+ }
24
+ }
25
+ catch (error) {
26
+ // state.json doesn't exist yet or contains invalid JSON
27
+ }
28
+ return {};
29
+ }
30
+ function loadLastShownTimestamp(status) {
31
+ const lastShown = readStateFile()[STATE_FLAGS_LAST_SHOWN[status]];
32
+ return typeof lastShown === 'string' ? moment(lastShown).valueOf() : 0;
33
+ }
34
+ function writeLastShownTimestamp(status, timestamp) {
35
+ fs.mkdirSync(path.dirname(STATE_FILE_PATH), { recursive: true });
36
+ const state = {
37
+ ...readStateFile(),
38
+ [STATE_FLAGS_LAST_SHOWN[status]]: moment(timestamp).toISOString(),
39
+ };
40
+ fs.writeFileSync(STATE_FILE_PATH, JSON.stringify(state, null, 2), 'utf-8');
41
+ }
42
+ function getDeprecationStatusForCurrentMajorVersion() {
43
+ const majorVersion = semver.major(pkg.version);
44
+ if (majorVersion !== CLI_DEPRECATED_MAJOR_VERSION) {
45
+ return null;
46
+ }
47
+ const now = moment();
48
+ if (now.isSameOrAfter(moment(CLI_DEPRECATED_MAJOR_VERSION_EOL_DATE))) {
49
+ return 'endOfLife';
50
+ }
51
+ if (now.isSameOrAfter(moment(CLI_DEPRECATED_MAJOR_VERSION_DEPRECATION_DATE))) {
52
+ return 'deprecated';
53
+ }
54
+ return null;
55
+ }
56
+ function hasShownWarningToday(status) {
57
+ return Date.now() - loadLastShownTimestamp(status) < ONE_DAY_IN_MILLISECONDS;
58
+ }
59
+ function logDeprecationStatusWarning(status) {
60
+ const eolDate = moment(CLI_DEPRECATED_MAJOR_VERSION_EOL_DATE).format('MMMM D, YYYY');
61
+ const message = status === 'endOfLife'
62
+ ? lib.middleware.deprecationWarning.endOfLifeMessage(pkg.version, eolDate)
63
+ : lib.middleware.deprecationWarning.deprecatedMessage(pkg.version, eolDate);
64
+ uiLogger.log(message);
65
+ writeLastShownTimestamp(status, Date.now());
66
+ }
67
+ export function checkDeprecationWarning() {
68
+ try {
69
+ const status = getDeprecationStatusForCurrentMajorVersion();
70
+ if (!status || hasShownWarningToday(status)) {
71
+ return;
72
+ }
73
+ logDeprecationStatusWarning(status);
74
+ }
75
+ catch (error) {
76
+ debugError(error);
77
+ }
78
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cli",
3
- "version": "7.11.3",
3
+ "version": "7.11.4",
4
4
  "description": "The official CLI for developing on HubSpot",
5
5
  "license": "Apache-2.0",
6
6
  "repository": "https://github.com/HubSpot/hubspot-cli",
@@ -70,6 +70,9 @@
70
70
  "@hubspot/cms-dev-server": "^1.2.1",
71
71
  "@modelcontextprotocol/sdk": "1.25.0"
72
72
  },
73
+ "resolutions": {
74
+ "eslint-visitor-keys": "4.2.0"
75
+ },
73
76
  "scripts": {
74
77
  "build": "tsx ./scripts/build.ts",
75
78
  "build-docker": "docker image build --tag hs-cli-image . && docker image prune -f",