@hubspot/cli 7.10.0 → 7.11.0-beta.0
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 +5 -4
- package/commands/__tests__/getStarted.test.js +10 -0
- package/commands/__tests__/project.test.js +3 -0
- package/commands/account/__tests__/rename.test.js +10 -3
- package/commands/account/auth.js +10 -14
- package/commands/account/clean.js +11 -19
- package/commands/account/createOverride.js +15 -11
- package/commands/account/info.js +8 -5
- package/commands/account/list.js +15 -19
- package/commands/account/remove.js +23 -22
- package/commands/account/removeOverride.js +6 -6
- package/commands/account/rename.js +2 -2
- package/commands/account/use.js +19 -8
- package/commands/app/__tests__/migrate.test.js +8 -4
- package/commands/app/migrate.js +2 -2
- package/commands/auth.js +18 -14
- package/commands/config/migrate.js +5 -5
- package/commands/customObject/createSchema.js +2 -3
- package/commands/customObject/updateSchema.js +2 -3
- package/commands/getStarted.js +2 -3
- package/commands/hubdb/__tests__/list.test.js +1 -0
- package/commands/hubdb/list.js +2 -2
- package/commands/init.js +36 -32
- package/commands/project/__tests__/deploy.test.js +16 -11
- package/commands/project/__tests__/devUnifiedFlow.test.js +6 -4
- package/commands/project/__tests__/lint.test.js +709 -0
- package/commands/project/__tests__/logs.test.js +4 -0
- package/commands/project/__tests__/validate.test.js +2 -2
- package/commands/project/cloneApp.js +2 -2
- package/commands/project/create.js +20 -14
- package/commands/project/deploy.js +2 -2
- package/commands/project/dev/deprecatedFlow.js +4 -5
- package/commands/project/dev/index.js +6 -3
- package/commands/project/dev/unifiedFlow.js +11 -6
- package/commands/project/lint.d.ts +6 -0
- package/commands/project/lint.js +178 -0
- package/commands/project/logs.js +2 -3
- package/commands/project/migrate.js +4 -13
- package/commands/project/profile/add.js +6 -7
- package/commands/project/profile/delete.js +2 -2
- package/commands/project/upload.js +2 -2
- package/commands/project/validate.js +2 -2
- package/commands/project.js +2 -0
- package/commands/sandbox/__tests__/create.test.js +14 -5
- package/commands/sandbox/create.js +4 -5
- package/commands/sandbox/delete.js +23 -20
- package/commands/testAccount/create.js +2 -2
- package/commands/testAccount/delete.js +9 -8
- package/lang/en.d.ts +54 -12
- package/lang/en.js +64 -16
- package/lib/__tests__/buildAccount.test.js +22 -30
- package/lib/__tests__/commonOpts.test.js +9 -13
- package/lib/__tests__/developerTestAccounts.test.js +29 -17
- package/lib/__tests__/importData.test.js +20 -10
- package/lib/__tests__/oauth.test.js +19 -8
- package/lib/__tests__/sandboxSync.test.js +33 -11
- package/lib/__tests__/sandboxes.test.js +30 -19
- package/lib/__tests__/usageTracking.test.js +10 -10
- package/lib/__tests__/validation.test.js +32 -32
- package/lib/accountTypes.d.ts +9 -9
- package/lib/accountTypes.js +2 -4
- package/lib/app/__tests__/migrate.test.js +15 -0
- package/lib/app/__tests__/migrate_legacy.test.js +9 -0
- package/lib/app/migrate_legacy.d.ts +2 -2
- package/lib/buildAccount.d.ts +4 -4
- package/lib/buildAccount.js +7 -14
- package/lib/commonOpts.js +3 -3
- package/lib/configMigrate.d.ts +2 -2
- package/lib/configMigrate.js +42 -18
- package/lib/configOptions.js +3 -2
- package/lib/developerTestAccounts.d.ts +3 -3
- package/lib/developerTestAccounts.js +4 -7
- package/lib/doctor/DiagnosticInfoBuilder.d.ts +1 -1
- package/lib/doctor/DiagnosticInfoBuilder.js +9 -6
- package/lib/doctor/Doctor.js +4 -3
- package/lib/doctor/__tests__/Diagnosis.test.js +4 -3
- package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.js +17 -9
- package/lib/doctor/__tests__/Doctor.test.js +14 -0
- package/lib/errorHandlers/index.js +10 -7
- package/lib/importData.js +8 -7
- package/lib/links.js +5 -5
- package/lib/middleware/{__test__ → __tests__}/commandTargetingUtils.test.js +3 -3
- package/lib/middleware/{__test__ → __tests__}/configMiddleware.test.js +23 -22
- package/lib/middleware/{__test__ → __tests__}/gitMiddleware.test.js +9 -7
- package/lib/middleware/autoUpdateMiddleware.js +34 -23
- package/lib/middleware/commandTargetingUtils.js +3 -2
- package/lib/middleware/configMiddleware.d.ts +6 -1
- package/lib/middleware/configMiddleware.js +36 -15
- package/lib/middleware/fireAlarmMiddleware.js +4 -15
- package/lib/middleware/gitMiddleware.js +8 -4
- package/lib/oauth.d.ts +2 -2
- package/lib/oauth.js +8 -10
- package/lib/projects/__tests__/AppDevModeInterface.test.js +17 -6
- package/lib/projects/__tests__/DevServerManager.test.js +1 -0
- package/lib/projects/__tests__/LocalDevProcess.test.js +1 -0
- package/lib/projects/__tests__/components.test.js +2 -22
- package/lib/projects/__tests__/deploy.test.js +16 -13
- package/lib/projects/__tests__/uieLinting.test.js +640 -0
- package/lib/projects/add/__tests__/legacyAddComponent.test.js +1 -1
- package/lib/projects/add/__tests__/v2AddComponent.test.js +30 -4
- package/lib/projects/add/legacyAddComponent.js +1 -1
- package/lib/projects/add/v2AddComponent.js +16 -5
- package/lib/projects/components.d.ts +8 -1
- package/lib/projects/components.js +91 -8
- package/lib/projects/create/__tests__/v2.test.js +11 -0
- package/lib/projects/deploy.js +21 -8
- package/lib/projects/localDev/AppDevModeInterface.js +2 -2
- package/lib/projects/localDev/DevServerManager_DEPRECATED.js +11 -3
- package/lib/projects/localDev/LocalDevLogger.js +4 -4
- package/lib/projects/localDev/LocalDevManager_DEPRECATED.js +3 -3
- package/lib/projects/localDev/helpers/account.d.ts +10 -10
- package/lib/projects/localDev/helpers/account.js +6 -11
- package/lib/projects/localDev/helpers/process.js +5 -3
- package/lib/projects/uieLinting.d.ts +33 -0
- package/lib/projects/uieLinting.js +222 -0
- package/lib/projects/urls.js +5 -6
- package/lib/prompts/__tests__/downloadProjectPrompt.test.js +7 -5
- package/lib/prompts/accountNamePrompt.js +3 -3
- package/lib/prompts/accountsPrompt.d.ts +1 -1
- package/lib/prompts/accountsPrompt.js +6 -7
- package/lib/prompts/confirmImportDataPrompt.js +2 -2
- package/lib/prompts/downloadProjectPrompt.d.ts +1 -0
- package/lib/prompts/downloadProjectPrompt.js +5 -2
- package/lib/prompts/importDataTestAccountSelectPrompt.js +4 -5
- package/lib/prompts/personalAccessKeyPrompt.js +2 -2
- package/lib/prompts/projectDevTargetAccountPrompt.d.ts +3 -3
- package/lib/prompts/projectDevTargetAccountPrompt.js +5 -7
- package/lib/prompts/sandboxesPrompt.js +7 -8
- package/lib/prompts/setAsDefaultAccountPrompt.js +7 -6
- package/lib/sandboxSync.d.ts +2 -2
- package/lib/sandboxSync.js +3 -9
- package/lib/sandboxes.d.ts +4 -4
- package/lib/sandboxes.js +6 -11
- package/lib/serverlessLogs.js +2 -2
- package/lib/theme/__tests__/migrate.test.js +15 -0
- package/lib/ui/SpinniesManager.d.ts +5 -7
- package/lib/ui/SpinniesManager.js +9 -12
- package/lib/ui/__tests__/SpinniesManager.test.d.ts +1 -0
- package/lib/ui/__tests__/SpinniesManager.test.js +489 -0
- package/lib/ui/index.js +6 -3
- package/lib/usageTracking.js +15 -8
- package/lib/validation.js +13 -11
- package/mcp-server/tools/cms/HsCreateFunctionTool.js +4 -2
- package/mcp-server/tools/cms/HsCreateModuleTool.js +4 -2
- package/mcp-server/tools/cms/HsCreateTemplateTool.js +4 -2
- package/mcp-server/tools/cms/HsFunctionLogsTool.js +4 -2
- package/mcp-server/tools/cms/HsListFunctionsTool.js +3 -1
- package/mcp-server/tools/cms/HsListTool.js +3 -1
- package/mcp-server/tools/cms/__tests__/HsCreateFunctionTool.test.js +1 -0
- package/mcp-server/tools/index.js +4 -0
- package/mcp-server/tools/project/AddFeatureToProjectTool.js +4 -2
- package/mcp-server/tools/project/CreateProjectTool.js +4 -2
- package/mcp-server/tools/project/CreateTestAccountTool.js +17 -7
- package/mcp-server/tools/project/DeployProjectTool.js +3 -1
- package/mcp-server/tools/project/DocFetchTool.js +6 -4
- package/mcp-server/tools/project/DocsSearchTool.d.ts +1 -1
- package/mcp-server/tools/project/DocsSearchTool.js +10 -8
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +1 -1
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +9 -7
- package/mcp-server/tools/project/GetApplicationInfoTool.js +8 -6
- package/mcp-server/tools/project/GetBuildLogsTool.d.ts +26 -0
- package/mcp-server/tools/project/GetBuildLogsTool.js +125 -0
- package/mcp-server/tools/project/GetBuildStatusTool.d.ts +26 -0
- package/mcp-server/tools/project/GetBuildStatusTool.js +166 -0
- package/mcp-server/tools/project/GetConfigValuesTool.d.ts +1 -1
- package/mcp-server/tools/project/GetConfigValuesTool.js +9 -7
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +1 -1
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +5 -3
- package/mcp-server/tools/project/UploadProjectTools.js +3 -1
- package/mcp-server/tools/project/ValidateProjectTool.js +4 -2
- package/mcp-server/tools/project/__tests__/CreateTestAccountTool.test.js +12 -2
- package/mcp-server/tools/project/__tests__/DocFetchTool.test.js +5 -1
- package/mcp-server/tools/project/__tests__/DocsSearchTool.test.js +23 -11
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.js +7 -5
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.js +7 -5
- package/mcp-server/tools/project/__tests__/GetBuildLogsTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GetBuildLogsTool.test.js +305 -0
- package/mcp-server/tools/project/__tests__/GetBuildStatusTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GetBuildStatusTool.test.js +240 -0
- package/mcp-server/tools/project/__tests__/GetConfigValuesTool.test.js +8 -6
- package/mcp-server/utils/__tests__/content.test.js +21 -20
- package/mcp-server/utils/__tests__/feedbackTracking.test.js +34 -28
- package/mcp-server/utils/config.d.ts +1 -0
- package/mcp-server/utils/config.js +10 -0
- package/mcp-server/utils/content.d.ts +1 -1
- package/mcp-server/utils/content.js +2 -2
- package/mcp-server/utils/feedbackTracking.d.ts +1 -1
- package/mcp-server/utils/feedbackTracking.js +3 -3
- package/mcp-server/utils/toolUsageTracking.js +4 -3
- package/package.json +9 -9
- package/ui/components/BoxWithTitle.d.ts +2 -1
- package/ui/components/BoxWithTitle.js +2 -2
- package/ui/components/StatusMessageBoxes.d.ts +5 -4
- package/ui/components/StatusMessageBoxes.js +8 -8
- package/lib/middleware/__test__/notificationsMiddleware.test.js +0 -8
- package/lib/middleware/notificationsMiddleware.d.ts +0 -1
- package/lib/middleware/notificationsMiddleware.js +0 -28
- package/lib/ui/boxen.d.ts +0 -5
- package/lib/ui/boxen.js +0 -26
- package/mcp-server/utils/__tests__/cliConfig.test.js +0 -110
- package/mcp-server/utils/cliConfig.d.ts +0 -1
- package/mcp-server/utils/cliConfig.js +0 -12
- /package/{lib/middleware/__test__/commandTargetingUtils.test.d.ts → commands/project/__tests__/lint.test.d.ts} +0 -0
- /package/lib/middleware/{__test__/configMiddleware.test.d.ts → __tests__/commandTargetingUtils.test.d.ts} +0 -0
- /package/lib/middleware/{__test__/gitMiddleware.test.d.ts → __tests__/configMiddleware.test.d.ts} +0 -0
- /package/lib/middleware/{__test__/notificationsMiddleware.test.d.ts → __tests__/gitMiddleware.test.d.ts} +0 -0
- /package/lib/middleware/{__test__ → __tests__}/requestMiddleware.test.d.ts +0 -0
- /package/lib/middleware/{__test__ → __tests__}/requestMiddleware.test.js +0 -0
- /package/lib/middleware/{__test__ → __tests__}/yargsChecksMiddleware.test.d.ts +0 -0
- /package/lib/middleware/{__test__ → __tests__}/yargsChecksMiddleware.test.js +0 -0
- /package/{mcp-server/utils/__tests__/cliConfig.test.d.ts → lib/projects/__tests__/uieLinting.test.d.ts} +0 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { GetConfigValuesTool } from '../GetConfigValuesTool.js';
|
|
2
2
|
import { getIntermediateRepresentationSchema, mapToInternalType, } from '@hubspot/project-parsing-lib';
|
|
3
|
-
import {
|
|
3
|
+
import { getConfigDefaultAccountIfExists } from '@hubspot/local-dev-lib/config';
|
|
4
4
|
import { mcpFeedbackRequest } from '../../../utils/feedbackTracking.js';
|
|
5
5
|
vi.mock('@modelcontextprotocol/sdk/server/mcp.js');
|
|
6
6
|
vi.mock('@hubspot/project-parsing-lib');
|
|
7
|
-
vi.mock('
|
|
7
|
+
vi.mock('@hubspot/local-dev-lib/config');
|
|
8
8
|
vi.mock('../../../utils/toolUsageTracking');
|
|
9
9
|
vi.mock('../../../utils/feedbackTracking');
|
|
10
10
|
const mockMcpFeedbackRequest = mcpFeedbackRequest;
|
|
11
11
|
const mockGetIntermediateRepresentationSchema = getIntermediateRepresentationSchema;
|
|
12
12
|
const mockMapToInternalType = mapToInternalType;
|
|
13
|
-
const
|
|
13
|
+
const mockGetConfigDefaultAccountIfExists = getConfigDefaultAccountIfExists;
|
|
14
14
|
describe('mcp-server/tools/project/GetConfigValuesTool', () => {
|
|
15
15
|
let mockMcpServer;
|
|
16
16
|
let tool;
|
|
@@ -51,7 +51,9 @@ describe('mcp-server/tools/project/GetConfigValuesTool', () => {
|
|
|
51
51
|
absoluteCurrentWorkingDirectory: '/foo',
|
|
52
52
|
};
|
|
53
53
|
beforeEach(() => {
|
|
54
|
-
|
|
54
|
+
mockGetConfigDefaultAccountIfExists.mockReturnValue({
|
|
55
|
+
accountId: 123456789,
|
|
56
|
+
});
|
|
55
57
|
});
|
|
56
58
|
it('should return config schema when component type exists', async () => {
|
|
57
59
|
const mockSchema = {
|
|
@@ -66,7 +68,7 @@ describe('mcp-server/tools/project/GetConfigValuesTool', () => {
|
|
|
66
68
|
mockGetIntermediateRepresentationSchema.mockResolvedValue(mockSchema);
|
|
67
69
|
mockMapToInternalType.mockReturnValue('internal-card-type');
|
|
68
70
|
const result = await tool.handler(input);
|
|
69
|
-
expect(
|
|
71
|
+
expect(mockGetConfigDefaultAccountIfExists).toHaveBeenCalled();
|
|
70
72
|
expect(mockGetIntermediateRepresentationSchema).toHaveBeenCalledWith({
|
|
71
73
|
platformVersion: '2025.2',
|
|
72
74
|
projectSourceDir: '',
|
|
@@ -139,7 +141,7 @@ describe('mcp-server/tools/project/GetConfigValuesTool', () => {
|
|
|
139
141
|
});
|
|
140
142
|
});
|
|
141
143
|
it('should handle null account id', async () => {
|
|
142
|
-
|
|
144
|
+
mockGetConfigDefaultAccountIfExists.mockReturnValue(undefined);
|
|
143
145
|
const result = await tool.handler(input);
|
|
144
146
|
expect(result).toEqual({
|
|
145
147
|
content: [
|
|
@@ -3,7 +3,6 @@ import { mcpFeedbackRequest } from '../feedbackTracking.js';
|
|
|
3
3
|
vi.mock('../feedbackTracking');
|
|
4
4
|
const mockMcpFeedbackRequest = mcpFeedbackRequest;
|
|
5
5
|
describe('mcp-server/utils/content', () => {
|
|
6
|
-
const mockWorkingDirectory = '/test/working/directory';
|
|
7
6
|
beforeEach(() => {
|
|
8
7
|
vi.clearAllMocks();
|
|
9
8
|
});
|
|
@@ -34,8 +33,8 @@ describe('mcp-server/utils/content', () => {
|
|
|
34
33
|
describe('formatTextContents', () => {
|
|
35
34
|
it('should format single output without feedback', async () => {
|
|
36
35
|
mockMcpFeedbackRequest.mockResolvedValue('');
|
|
37
|
-
const result = await formatTextContents(
|
|
38
|
-
expect(mockMcpFeedbackRequest).
|
|
36
|
+
const result = await formatTextContents('Test output');
|
|
37
|
+
expect(mockMcpFeedbackRequest).toHaveBeenCalled();
|
|
39
38
|
expect(result).toEqual({
|
|
40
39
|
content: [
|
|
41
40
|
{
|
|
@@ -47,7 +46,7 @@ describe('mcp-server/utils/content', () => {
|
|
|
47
46
|
});
|
|
48
47
|
it('should format multiple outputs without feedback', async () => {
|
|
49
48
|
mockMcpFeedbackRequest.mockResolvedValue('');
|
|
50
|
-
const result = await formatTextContents(
|
|
49
|
+
const result = await formatTextContents('First output', 'Second output', 'Third output');
|
|
51
50
|
expect(result).toEqual({
|
|
52
51
|
content: [
|
|
53
52
|
{ type: 'text', text: 'First output' },
|
|
@@ -59,8 +58,8 @@ describe('mcp-server/utils/content', () => {
|
|
|
59
58
|
it('should append feedback message when feedback is returned', async () => {
|
|
60
59
|
const feedbackMessage = 'Please share your feedback!';
|
|
61
60
|
mockMcpFeedbackRequest.mockResolvedValue(feedbackMessage);
|
|
62
|
-
const result = await formatTextContents(
|
|
63
|
-
expect(mockMcpFeedbackRequest).
|
|
61
|
+
const result = await formatTextContents('Command output');
|
|
62
|
+
expect(mockMcpFeedbackRequest).toHaveBeenCalled();
|
|
64
63
|
expect(result).toEqual({
|
|
65
64
|
content: [
|
|
66
65
|
{ type: 'text', text: 'Command output' },
|
|
@@ -71,7 +70,7 @@ describe('mcp-server/utils/content', () => {
|
|
|
71
70
|
it('should append feedback to multiple outputs', async () => {
|
|
72
71
|
const feedbackMessage = 'Feedback request message';
|
|
73
72
|
mockMcpFeedbackRequest.mockResolvedValue(feedbackMessage);
|
|
74
|
-
const result = await formatTextContents(
|
|
73
|
+
const result = await formatTextContents('First output', 'Second output');
|
|
75
74
|
expect(result).toEqual({
|
|
76
75
|
content: [
|
|
77
76
|
{ type: 'text', text: 'First output' },
|
|
@@ -82,7 +81,7 @@ describe('mcp-server/utils/content', () => {
|
|
|
82
81
|
});
|
|
83
82
|
it('should filter out undefined outputs', async () => {
|
|
84
83
|
mockMcpFeedbackRequest.mockResolvedValue('');
|
|
85
|
-
const result = await formatTextContents(
|
|
84
|
+
const result = await formatTextContents('First output', undefined, 'Third output', undefined);
|
|
86
85
|
expect(result).toEqual({
|
|
87
86
|
content: [
|
|
88
87
|
{ type: 'text', text: 'First output' },
|
|
@@ -92,7 +91,7 @@ describe('mcp-server/utils/content', () => {
|
|
|
92
91
|
});
|
|
93
92
|
it('should not call mcpFeedbackRequest when no outputs provided', async () => {
|
|
94
93
|
mockMcpFeedbackRequest.mockResolvedValue('Feedback message');
|
|
95
|
-
const result = await formatTextContents(
|
|
94
|
+
const result = await formatTextContents();
|
|
96
95
|
expect(mockMcpFeedbackRequest).not.toHaveBeenCalled();
|
|
97
96
|
expect(result).toEqual({
|
|
98
97
|
content: [],
|
|
@@ -100,24 +99,24 @@ describe('mcp-server/utils/content', () => {
|
|
|
100
99
|
});
|
|
101
100
|
it('should call mcpFeedbackRequest but not add feedback when all outputs are undefined and feedback is empty', async () => {
|
|
102
101
|
mockMcpFeedbackRequest.mockResolvedValue('');
|
|
103
|
-
const result = await formatTextContents(
|
|
102
|
+
const result = await formatTextContents(undefined, undefined);
|
|
104
103
|
// mcpFeedbackRequest is still called because outputs.length > 0, but content is empty
|
|
105
|
-
expect(mockMcpFeedbackRequest).
|
|
104
|
+
expect(mockMcpFeedbackRequest).toHaveBeenCalled();
|
|
106
105
|
expect(result).toEqual({
|
|
107
106
|
content: [],
|
|
108
107
|
});
|
|
109
108
|
});
|
|
110
109
|
it('should handle empty string outputs and still request feedback', async () => {
|
|
111
110
|
mockMcpFeedbackRequest.mockResolvedValue('');
|
|
112
|
-
const result = await formatTextContents(
|
|
113
|
-
expect(mockMcpFeedbackRequest).
|
|
111
|
+
const result = await formatTextContents('');
|
|
112
|
+
expect(mockMcpFeedbackRequest).toHaveBeenCalled();
|
|
114
113
|
expect(result).toEqual({
|
|
115
114
|
content: [{ type: 'text', text: '' }],
|
|
116
115
|
});
|
|
117
116
|
});
|
|
118
117
|
it('should not add feedback when empty string is returned from mcpFeedbackRequest', async () => {
|
|
119
118
|
mockMcpFeedbackRequest.mockResolvedValue('');
|
|
120
|
-
const result = await formatTextContents(
|
|
119
|
+
const result = await formatTextContents('Output 1', 'Output 2');
|
|
121
120
|
// Should not have a third content item with empty feedback
|
|
122
121
|
expect(result.content).toHaveLength(2);
|
|
123
122
|
expect(result).toEqual({
|
|
@@ -137,7 +136,7 @@ describe('mcp-server/utils/content', () => {
|
|
|
137
136
|
|
|
138
137
|
Say: "📝 **Before we continue, would you mind sharing feedback on your experience with the HubSpot Developer MCP?** Your input helps us improve: [Share feedback here](https://app.hubspot.com/l/product-updates/in-beta?rollout=239890)"`;
|
|
139
138
|
mockMcpFeedbackRequest.mockResolvedValue(realisticFeedback);
|
|
140
|
-
const result = await formatTextContents(
|
|
139
|
+
const result = await formatTextContents('Project created successfully');
|
|
141
140
|
expect(result.content).toHaveLength(2);
|
|
142
141
|
expect(result.content[0]).toEqual({
|
|
143
142
|
type: 'text',
|
|
@@ -149,16 +148,18 @@ describe('mcp-server/utils/content', () => {
|
|
|
149
148
|
});
|
|
150
149
|
expect(result.content[1].text).toContain('FEEDBACK REQUEST');
|
|
151
150
|
});
|
|
152
|
-
it('should
|
|
153
|
-
const customDirectory = '/custom/working/directory';
|
|
151
|
+
it('should not require absoluteCurrentWorkingDirectory parameter', async () => {
|
|
154
152
|
mockMcpFeedbackRequest.mockResolvedValue('');
|
|
155
|
-
await formatTextContents(
|
|
156
|
-
expect(mockMcpFeedbackRequest).
|
|
153
|
+
const result = await formatTextContents('Test output');
|
|
154
|
+
expect(mockMcpFeedbackRequest).toHaveBeenCalled();
|
|
155
|
+
expect(result).toEqual({
|
|
156
|
+
content: [{ type: 'text', text: 'Test output' }],
|
|
157
|
+
});
|
|
157
158
|
});
|
|
158
159
|
it('should await mcpFeedbackRequest and handle async properly', async () => {
|
|
159
160
|
const feedbackPromise = Promise.resolve('Async feedback message');
|
|
160
161
|
mockMcpFeedbackRequest.mockReturnValue(feedbackPromise);
|
|
161
|
-
const result = await formatTextContents(
|
|
162
|
+
const result = await formatTextContents('Output');
|
|
162
163
|
expect(result.content).toHaveLength(2);
|
|
163
164
|
expect(result.content[1].text).toBe('Async feedback message');
|
|
164
165
|
});
|
|
@@ -1,82 +1,86 @@
|
|
|
1
1
|
import { mcpFeedbackRequest } from '../feedbackTracking.js';
|
|
2
2
|
import { getStateValue, setStateValue, } from '@hubspot/local-dev-lib/config/state';
|
|
3
|
-
import {
|
|
3
|
+
import { getConfigDefaultAccountIfExists } from '@hubspot/local-dev-lib/config';
|
|
4
4
|
import { hasFeature } from '../../../lib/hasFeature.js';
|
|
5
5
|
import { FEATURES } from '../../../lib/constants.js';
|
|
6
6
|
vi.mock('@hubspot/local-dev-lib/config/state');
|
|
7
|
-
vi.mock('
|
|
7
|
+
vi.mock('@hubspot/local-dev-lib/config');
|
|
8
|
+
vi.mock('@hubspot/local-dev-lib/logger');
|
|
8
9
|
vi.mock('../../../lib/hasFeature');
|
|
9
10
|
vi.mock('../../../lib/errorHandlers/index');
|
|
10
11
|
const mockGetStateValue = getStateValue;
|
|
11
12
|
const mockSetStateValue = setStateValue;
|
|
12
|
-
const
|
|
13
|
+
const mockGetConfigDefaultAccountIfExists = getConfigDefaultAccountIfExists;
|
|
13
14
|
const mockHasFeature = hasFeature;
|
|
14
15
|
describe('mcp-server/utils/feedbackTracking', () => {
|
|
15
|
-
const mockWorkingDirectory = '/test/working/directory';
|
|
16
16
|
beforeEach(() => {
|
|
17
17
|
vi.clearAllMocks();
|
|
18
18
|
});
|
|
19
19
|
describe('mcpFeedbackRequest', () => {
|
|
20
20
|
it('should return empty string when not at a threshold', async () => {
|
|
21
21
|
mockGetStateValue.mockReturnValue(10);
|
|
22
|
-
const result = await mcpFeedbackRequest(
|
|
22
|
+
const result = await mcpFeedbackRequest();
|
|
23
23
|
expect(mockSetStateValue).toHaveBeenCalledWith('mcpTotalToolCalls', 11);
|
|
24
24
|
expect(result).toBe(undefined);
|
|
25
25
|
});
|
|
26
26
|
it('should return feedback message at threshold 50', async () => {
|
|
27
27
|
mockGetStateValue.mockReturnValue(49);
|
|
28
|
-
|
|
29
|
-
const result = await mcpFeedbackRequest(
|
|
28
|
+
mockGetConfigDefaultAccountIfExists.mockReturnValue(undefined);
|
|
29
|
+
const result = await mcpFeedbackRequest();
|
|
30
30
|
expect(mockSetStateValue).toHaveBeenCalledWith('mcpTotalToolCalls', 50);
|
|
31
31
|
expect(result).toContain('FEEDBACK REQUEST');
|
|
32
32
|
expect(result).toContain('https://app.hubspot.com/l/product-updates/in-beta?rollout=239890');
|
|
33
33
|
});
|
|
34
34
|
it('should return feedback message at threshold 250', async () => {
|
|
35
35
|
mockGetStateValue.mockReturnValue(249);
|
|
36
|
-
|
|
37
|
-
const result = await mcpFeedbackRequest(
|
|
36
|
+
mockGetConfigDefaultAccountIfExists.mockReturnValue(undefined);
|
|
37
|
+
const result = await mcpFeedbackRequest();
|
|
38
38
|
expect(mockSetStateValue).toHaveBeenCalledWith('mcpTotalToolCalls', 250);
|
|
39
39
|
expect(result).toContain('FEEDBACK REQUEST');
|
|
40
40
|
});
|
|
41
41
|
it('should return feedback message at threshold 550', async () => {
|
|
42
42
|
mockGetStateValue.mockReturnValue(549);
|
|
43
|
-
|
|
44
|
-
const result = await mcpFeedbackRequest(
|
|
43
|
+
mockGetConfigDefaultAccountIfExists.mockReturnValue(undefined);
|
|
44
|
+
const result = await mcpFeedbackRequest();
|
|
45
45
|
expect(mockSetStateValue).toHaveBeenCalledWith('mcpTotalToolCalls', 550);
|
|
46
46
|
expect(result).toContain('FEEDBACK REQUEST');
|
|
47
47
|
});
|
|
48
48
|
it('should return feedback message at threshold 1050', async () => {
|
|
49
49
|
mockGetStateValue.mockReturnValue(1049);
|
|
50
|
-
|
|
51
|
-
const result = await mcpFeedbackRequest(
|
|
50
|
+
mockGetConfigDefaultAccountIfExists.mockReturnValue(undefined);
|
|
51
|
+
const result = await mcpFeedbackRequest();
|
|
52
52
|
expect(mockSetStateValue).toHaveBeenCalledWith('mcpTotalToolCalls', 1050);
|
|
53
53
|
expect(result).toContain('FEEDBACK REQUEST');
|
|
54
54
|
});
|
|
55
55
|
it('should use account-specific URL when account has MCP access', async () => {
|
|
56
56
|
const accountId = 12345;
|
|
57
57
|
mockGetStateValue.mockReturnValue(49);
|
|
58
|
-
|
|
58
|
+
mockGetConfigDefaultAccountIfExists.mockReturnValue({
|
|
59
|
+
accountId,
|
|
60
|
+
});
|
|
59
61
|
mockHasFeature.mockResolvedValue(true);
|
|
60
|
-
const result = await mcpFeedbackRequest(
|
|
61
|
-
expect(
|
|
62
|
+
const result = await mcpFeedbackRequest();
|
|
63
|
+
expect(mockGetConfigDefaultAccountIfExists).toHaveBeenCalled();
|
|
62
64
|
expect(mockHasFeature).toHaveBeenCalledWith(accountId, FEATURES.MCP_ACCESS);
|
|
63
65
|
expect(result).toContain(`https://app.hubspot.com/product-updates/${accountId}/in-beta?rollout=239890`);
|
|
64
66
|
});
|
|
65
67
|
it('should use default URL when account does not have MCP access', async () => {
|
|
66
68
|
const accountId = 12345;
|
|
67
69
|
mockGetStateValue.mockReturnValue(49);
|
|
68
|
-
|
|
70
|
+
mockGetConfigDefaultAccountIfExists.mockReturnValue({
|
|
71
|
+
accountId,
|
|
72
|
+
});
|
|
69
73
|
mockHasFeature.mockResolvedValue(false);
|
|
70
|
-
const result = await mcpFeedbackRequest(
|
|
74
|
+
const result = await mcpFeedbackRequest();
|
|
71
75
|
expect(mockHasFeature).toHaveBeenCalledWith(accountId, FEATURES.MCP_ACCESS);
|
|
72
76
|
expect(result).toContain('https://app.hubspot.com/l/product-updates/in-beta?rollout=239890');
|
|
73
77
|
expect(result).not.toContain(`/product-updates/${accountId}/`);
|
|
74
78
|
});
|
|
75
79
|
it('should use default URL when no account ID is found', async () => {
|
|
76
80
|
mockGetStateValue.mockReturnValue(49);
|
|
77
|
-
|
|
78
|
-
const result = await mcpFeedbackRequest(
|
|
79
|
-
expect(
|
|
81
|
+
mockGetConfigDefaultAccountIfExists.mockReturnValue(undefined);
|
|
82
|
+
const result = await mcpFeedbackRequest();
|
|
83
|
+
expect(mockGetConfigDefaultAccountIfExists).toHaveBeenCalled();
|
|
80
84
|
expect(mockHasFeature).not.toHaveBeenCalled();
|
|
81
85
|
expect(result).toContain('https://app.hubspot.com/l/product-updates/in-beta?rollout=239890');
|
|
82
86
|
});
|
|
@@ -84,35 +88,37 @@ describe('mcp-server/utils/feedbackTracking', () => {
|
|
|
84
88
|
mockGetStateValue.mockImplementation(() => {
|
|
85
89
|
throw new Error('State error');
|
|
86
90
|
});
|
|
87
|
-
const result = await mcpFeedbackRequest(
|
|
91
|
+
const result = await mcpFeedbackRequest();
|
|
88
92
|
expect(result).toBe(undefined);
|
|
89
93
|
});
|
|
90
94
|
it('should handle hasFeature errors and use default URL', async () => {
|
|
91
95
|
const accountId = 12345;
|
|
92
96
|
mockGetStateValue.mockReturnValue(49);
|
|
93
|
-
|
|
97
|
+
mockGetConfigDefaultAccountIfExists.mockReturnValue({
|
|
98
|
+
accountId,
|
|
99
|
+
});
|
|
94
100
|
mockHasFeature.mockRejectedValue(new Error('Feature check failed'));
|
|
95
|
-
const result = await mcpFeedbackRequest(
|
|
101
|
+
const result = await mcpFeedbackRequest();
|
|
96
102
|
expect(result).toContain('https://app.hubspot.com/l/product-updates/in-beta?rollout=239890');
|
|
97
103
|
expect(result).not.toContain(`/product-updates/${accountId}/`);
|
|
98
104
|
});
|
|
99
105
|
it('should not return feedback at threshold + 1', async () => {
|
|
100
106
|
mockGetStateValue.mockReturnValue(50);
|
|
101
|
-
const result = await mcpFeedbackRequest(
|
|
107
|
+
const result = await mcpFeedbackRequest();
|
|
102
108
|
expect(mockSetStateValue).toHaveBeenCalledWith('mcpTotalToolCalls', 51);
|
|
103
109
|
expect(result).toBe(undefined);
|
|
104
110
|
});
|
|
105
111
|
it('should increment tool calls counter on every invocation', async () => {
|
|
106
112
|
const initialCount = 100;
|
|
107
113
|
mockGetStateValue.mockReturnValue(initialCount);
|
|
108
|
-
await mcpFeedbackRequest(
|
|
114
|
+
await mcpFeedbackRequest();
|
|
109
115
|
expect(mockGetStateValue).toHaveBeenCalledWith('mcpTotalToolCalls');
|
|
110
116
|
expect(mockSetStateValue).toHaveBeenCalledWith('mcpTotalToolCalls', initialCount + 1);
|
|
111
117
|
});
|
|
112
118
|
it('should include feedback request instructions in message', async () => {
|
|
113
119
|
mockGetStateValue.mockReturnValue(49);
|
|
114
|
-
|
|
115
|
-
const result = await mcpFeedbackRequest(
|
|
120
|
+
mockGetConfigDefaultAccountIfExists.mockReturnValue(undefined);
|
|
121
|
+
const result = await mcpFeedbackRequest();
|
|
116
122
|
expect(result).toContain('IMPORTANT - FEEDBACK REQUEST');
|
|
117
123
|
expect(result).toContain('This message appears only once');
|
|
118
124
|
expect(result).toContain('Share feedback here');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function setupHubSpotConfig(absoluteCurrentWorkingDirectory: string): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { getLocalConfigFilePathIfExists } from '@hubspot/local-dev-lib/config';
|
|
2
|
+
export function setupHubSpotConfig(absoluteCurrentWorkingDirectory) {
|
|
3
|
+
if (!absoluteCurrentWorkingDirectory) {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
const configPath = getLocalConfigFilePathIfExists(absoluteCurrentWorkingDirectory);
|
|
7
|
+
if (configPath) {
|
|
8
|
+
process.env.HUBSPOT_CONFIG_PATH = configPath;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { TextContent, TextContentResponse } from '../types.js';
|
|
2
|
-
export declare function formatTextContents(
|
|
2
|
+
export declare function formatTextContents(...outputs: (string | undefined)[]): Promise<TextContentResponse>;
|
|
3
3
|
export declare function formatTextContent(text: string): TextContent;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { mcpFeedbackRequest } from './feedbackTracking.js';
|
|
2
|
-
export async function formatTextContents(
|
|
2
|
+
export async function formatTextContents(...outputs) {
|
|
3
3
|
const content = [];
|
|
4
4
|
outputs.forEach(output => {
|
|
5
5
|
if (output !== undefined) {
|
|
@@ -7,7 +7,7 @@ export async function formatTextContents(absoluteCurrentWorkingDirectory, ...out
|
|
|
7
7
|
}
|
|
8
8
|
});
|
|
9
9
|
if (outputs.length > 0) {
|
|
10
|
-
const feedback = await mcpFeedbackRequest(
|
|
10
|
+
const feedback = await mcpFeedbackRequest();
|
|
11
11
|
if (feedback) {
|
|
12
12
|
content.push(formatTextContent(feedback));
|
|
13
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function mcpFeedbackRequest(
|
|
1
|
+
export declare function mcpFeedbackRequest(): Promise<string | undefined>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { getStateValue, setStateValue, } from '@hubspot/local-dev-lib/config/state';
|
|
2
|
-
import {
|
|
2
|
+
import { getConfigDefaultAccountIfExists } from '@hubspot/local-dev-lib/config';
|
|
3
3
|
import { hasFeature } from '../../lib/hasFeature.js';
|
|
4
4
|
import { FEATURES } from '../../lib/constants.js';
|
|
5
5
|
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
6
6
|
import { MCP_TOTAL_TOOL_CALLS_STATE } from '@hubspot/local-dev-lib/constants/config';
|
|
7
7
|
const FEEDBACK_THRESHOLDS = [50, 250, 550, 1050];
|
|
8
|
-
export async function mcpFeedbackRequest(
|
|
8
|
+
export async function mcpFeedbackRequest() {
|
|
9
9
|
let feedbackUrl = 'https://app.hubspot.com/l/product-updates/in-beta?rollout=239890';
|
|
10
10
|
try {
|
|
11
11
|
const currentCount = getStateValue(MCP_TOTAL_TOOL_CALLS_STATE);
|
|
@@ -14,7 +14,7 @@ export async function mcpFeedbackRequest(absoluteCurrentWorkingDirectory) {
|
|
|
14
14
|
if (!FEEDBACK_THRESHOLDS.includes(newCount)) {
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
|
-
const accountId =
|
|
17
|
+
const accountId = getConfigDefaultAccountIfExists()?.accountId;
|
|
18
18
|
if (accountId) {
|
|
19
19
|
try {
|
|
20
20
|
const hasMcpAccess = await hasFeature(accountId, FEATURES.MCP_ACCESS);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { trackUsage } from '@hubspot/local-dev-lib/trackUsage';
|
|
2
2
|
import { EventClass, getNodeVersionData, getPlatform, } from '../../lib/usageTracking.js';
|
|
3
|
-
import {
|
|
3
|
+
import { getConfig, getConfigDefaultAccountIfExists, } from '@hubspot/local-dev-lib/config';
|
|
4
4
|
import { uiLogger } from '../../lib/ui/logger.js';
|
|
5
5
|
export async function trackToolUsage(toolName, meta) {
|
|
6
|
-
|
|
6
|
+
const config = getConfig();
|
|
7
|
+
if (config?.allowUsageTracking === false) {
|
|
7
8
|
return;
|
|
8
9
|
}
|
|
9
10
|
const usageTrackingEvent = {
|
|
@@ -14,7 +15,7 @@ export async function trackToolUsage(toolName, meta) {
|
|
|
14
15
|
type: process.env.HUBSPOT_MCP_AI_AGENT,
|
|
15
16
|
...meta,
|
|
16
17
|
};
|
|
17
|
-
const accountId =
|
|
18
|
+
const accountId = getConfigDefaultAccountIfExists()?.accountId || undefined;
|
|
18
19
|
try {
|
|
19
20
|
uiLogger.info('Tracking tool usage');
|
|
20
21
|
await trackUsage('cli-interaction', EventClass.INTERACTION, usageTrackingEvent, accountId);
|
package/package.json
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cli",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.11.0-beta.0",
|
|
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",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@hubspot/local-dev-lib": "
|
|
10
|
-
"@hubspot/project-parsing-lib": "0.10.
|
|
11
|
-
"@hubspot/serverless-dev-runtime": "7.0.
|
|
12
|
-
"@hubspot/theme-preview-dev-server": "0.0.
|
|
13
|
-
"@hubspot/ui-extensions-dev-server": "0.
|
|
9
|
+
"@hubspot/local-dev-lib": "4.0.1",
|
|
10
|
+
"@hubspot/project-parsing-lib": "0.10.2",
|
|
11
|
+
"@hubspot/serverless-dev-runtime": "7.0.7",
|
|
12
|
+
"@hubspot/theme-preview-dev-server": "0.0.12",
|
|
13
|
+
"@hubspot/ui-extensions-dev-server": "1.0.1",
|
|
14
14
|
"archiver": "7.0.1",
|
|
15
|
-
"boxen": "8.0.1",
|
|
16
15
|
"chalk": "5.4.1",
|
|
17
16
|
"chokidar": "3.6.0",
|
|
18
17
|
"cli-cursor": "3.1.0",
|
|
@@ -36,7 +35,7 @@
|
|
|
36
35
|
"yargs-parser": "21.1.1"
|
|
37
36
|
},
|
|
38
37
|
"devDependencies": {
|
|
39
|
-
"@hubspot/npm-scripts": "0.0.
|
|
38
|
+
"@hubspot/npm-scripts": "0.0.6",
|
|
40
39
|
"@types/archiver": "^6.0.3",
|
|
41
40
|
"@types/cli-progress": "^3.11.6",
|
|
42
41
|
"@types/express": "^5.0.0",
|
|
@@ -68,7 +67,7 @@
|
|
|
68
67
|
"vitest": "^2.1.9"
|
|
69
68
|
},
|
|
70
69
|
"optionalDependencies": {
|
|
71
|
-
"@hubspot/cms-dev-server": "^1.
|
|
70
|
+
"@hubspot/cms-dev-server": "^1.2.1",
|
|
72
71
|
"@modelcontextprotocol/sdk": "1.13.3"
|
|
73
72
|
},
|
|
74
73
|
"scripts": {
|
|
@@ -92,6 +91,7 @@
|
|
|
92
91
|
"test-cli-debug": "yarn build && yarn --cwd 'acceptance-tests' test-debug",
|
|
93
92
|
"test-cli-latest": "yarn build && yarn build-docker && docker container run -it --rm --name=hs-cli-container hs-cli-image yarn --cwd 'acceptance-tests' test-latest",
|
|
94
93
|
"test-cli-qa": "yarn build && yarn --cwd 'acceptance-tests' test-qa",
|
|
94
|
+
"test-cli-qa-debug": "yarn build && yarn --cwd 'acceptance-tests' test-qa-debug",
|
|
95
95
|
"update-ldl": "yarn add --exact @hubspot/local-dev-lib@latest",
|
|
96
96
|
"view-unreleased-changes": "node ./scripts/unreleasedChanges.js"
|
|
97
97
|
},
|
|
@@ -3,6 +3,7 @@ export interface BoxWithTitleProps {
|
|
|
3
3
|
message: string;
|
|
4
4
|
titleBackgroundColor?: string;
|
|
5
5
|
borderColor?: string;
|
|
6
|
+
textCentered?: boolean;
|
|
6
7
|
}
|
|
7
8
|
export declare function getBoxWithTitle(props: BoxWithTitleProps): React.ReactNode;
|
|
8
|
-
export declare function BoxWithTitle({ title, message, titleBackgroundColor, borderColor, }: BoxWithTitleProps): React.ReactNode;
|
|
9
|
+
export declare function BoxWithTitle({ title, message, titleBackgroundColor, borderColor, textCentered, }: BoxWithTitleProps): React.ReactNode;
|
|
@@ -4,6 +4,6 @@ import { CONTAINER_STYLES } from '../styles.js';
|
|
|
4
4
|
export function getBoxWithTitle(props) {
|
|
5
5
|
return _jsx(BoxWithTitle, { ...props });
|
|
6
6
|
}
|
|
7
|
-
export function BoxWithTitle({ title, message, titleBackgroundColor, borderColor, }) {
|
|
8
|
-
return (_jsxs(Box, { ...CONTAINER_STYLES, borderStyle: "round", borderColor: borderColor, children: [_jsx(Box, { position: "absolute", marginTop: -2, paddingX: 0, alignSelf: "flex-start", justifyContent: "center", alignItems: "center", children: _jsx(Text, { backgroundColor: titleBackgroundColor, bold: true, children: ` ${title} ` }) }), _jsx(Box, {
|
|
7
|
+
export function BoxWithTitle({ title, message, titleBackgroundColor, borderColor, textCentered, }) {
|
|
8
|
+
return (_jsxs(Box, { ...CONTAINER_STYLES, borderStyle: "round", borderColor: borderColor, alignSelf: "flex-start", children: [_jsx(Box, { position: "absolute", marginTop: -2, paddingX: 0, alignSelf: "flex-start", justifyContent: "center", alignItems: "center", children: _jsx(Text, { backgroundColor: titleBackgroundColor, bold: true, children: ` ${title} ` }) }), _jsx(Box, { flexDirection: "column", width: "100%", rowGap: 1, children: message.split('\n\n').map((section, sectionIndex) => (_jsx(Box, { flexDirection: "column", alignItems: textCentered ? 'center' : 'flex-start', children: section.split('\n').map((line, lineIndex) => (_jsx(Text, { children: line }, `${sectionIndex}-${lineIndex}`))) }, sectionIndex))) })] }));
|
|
9
9
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export interface StatusMessageBoxProps {
|
|
2
2
|
title: string;
|
|
3
3
|
message: string;
|
|
4
|
+
textCentered?: boolean;
|
|
4
5
|
}
|
|
5
6
|
export declare function getWarningBox(props: StatusMessageBoxProps): React.ReactNode;
|
|
6
|
-
export declare function WarningBox({ title, message, }: StatusMessageBoxProps): React.ReactNode;
|
|
7
|
+
export declare function WarningBox({ title, message, textCentered, }: StatusMessageBoxProps): React.ReactNode;
|
|
7
8
|
export declare function getAlertBox(props: StatusMessageBoxProps): React.ReactNode;
|
|
8
|
-
export declare function AlertBox({ title, message, }: StatusMessageBoxProps): React.ReactNode;
|
|
9
|
+
export declare function AlertBox({ title, message, textCentered, }: StatusMessageBoxProps): React.ReactNode;
|
|
9
10
|
export declare function getSuccessBox(props: StatusMessageBoxProps): React.ReactNode;
|
|
10
|
-
export declare function SuccessBox({ title, message, }: StatusMessageBoxProps): React.ReactNode;
|
|
11
|
+
export declare function SuccessBox({ title, message, textCentered, }: StatusMessageBoxProps): React.ReactNode;
|
|
11
12
|
export declare function getInfoBox(props: StatusMessageBoxProps): React.ReactNode;
|
|
12
|
-
export declare function InfoBox({ title, message, }: StatusMessageBoxProps): React.ReactNode;
|
|
13
|
+
export declare function InfoBox({ title, message, textCentered, }: StatusMessageBoxProps): React.ReactNode;
|
|
@@ -4,28 +4,28 @@ import { BoxWithTitle } from './BoxWithTitle.js';
|
|
|
4
4
|
export function getWarningBox(props) {
|
|
5
5
|
return _jsx(WarningBox, { ...props });
|
|
6
6
|
}
|
|
7
|
-
export function WarningBox({ title, message, }) {
|
|
7
|
+
export function WarningBox({ title, message, textCentered, }) {
|
|
8
8
|
const color = INK_COLORS.WARNING_YELLOW;
|
|
9
|
-
return (_jsx(BoxWithTitle, { title: title, message: message, titleBackgroundColor: color, borderColor: color }));
|
|
9
|
+
return (_jsx(BoxWithTitle, { title: title, message: message, titleBackgroundColor: color, borderColor: color, textCentered: textCentered }));
|
|
10
10
|
}
|
|
11
11
|
export function getAlertBox(props) {
|
|
12
12
|
return _jsx(AlertBox, { ...props });
|
|
13
13
|
}
|
|
14
|
-
export function AlertBox({ title, message, }) {
|
|
14
|
+
export function AlertBox({ title, message, textCentered, }) {
|
|
15
15
|
const color = INK_COLORS.ALERT_RED;
|
|
16
|
-
return (_jsx(BoxWithTitle, { title: title, message: message, titleBackgroundColor: color, borderColor: color }));
|
|
16
|
+
return (_jsx(BoxWithTitle, { title: title, message: message, titleBackgroundColor: color, borderColor: color, textCentered: textCentered }));
|
|
17
17
|
}
|
|
18
18
|
export function getSuccessBox(props) {
|
|
19
19
|
return _jsx(SuccessBox, { ...props });
|
|
20
20
|
}
|
|
21
|
-
export function SuccessBox({ title, message, }) {
|
|
21
|
+
export function SuccessBox({ title, message, textCentered, }) {
|
|
22
22
|
const color = INK_COLORS.SUCCESS_GREEN;
|
|
23
|
-
return (_jsx(BoxWithTitle, { title: title, message: message, titleBackgroundColor: color, borderColor: color }));
|
|
23
|
+
return (_jsx(BoxWithTitle, { title: title, message: message, titleBackgroundColor: color, borderColor: color, textCentered: textCentered }));
|
|
24
24
|
}
|
|
25
25
|
export function getInfoBox(props) {
|
|
26
26
|
return _jsx(InfoBox, { ...props });
|
|
27
27
|
}
|
|
28
|
-
export function InfoBox({ title, message, }) {
|
|
28
|
+
export function InfoBox({ title, message, textCentered, }) {
|
|
29
29
|
const color = INK_COLORS.INFO_BLUE;
|
|
30
|
-
return (_jsx(BoxWithTitle, { title: title, message: message, titleBackgroundColor: color, borderColor: color }));
|
|
30
|
+
return (_jsx(BoxWithTitle, { title: title, message: message, titleBackgroundColor: color, borderColor: color, textCentered: textCentered }));
|
|
31
31
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { notifyAboutUpdates } from '../notificationsMiddleware.js';
|
|
2
|
-
describe('lib/middleware/notificationsMiddleware', () => {
|
|
3
|
-
describe('notifyAboutUpdates()', () => {
|
|
4
|
-
it('should safely execute without throwing an error', () => {
|
|
5
|
-
expect(() => notifyAboutUpdates()).not.toThrow();
|
|
6
|
-
});
|
|
7
|
-
});
|
|
8
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function notifyAboutUpdates(): void;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import updateNotifier from 'update-notifier';
|
|
2
|
-
import { pkg } from '../jsonLoader.js';
|
|
3
|
-
import { UI_COLORS } from '../ui/index.js';
|
|
4
|
-
import { lib } from '../../lang/en.js';
|
|
5
|
-
const notifier = updateNotifier({
|
|
6
|
-
pkg: { ...pkg, name: '@hubspot/cli' },
|
|
7
|
-
distTag: 'latest',
|
|
8
|
-
shouldNotifyInNpmScript: true,
|
|
9
|
-
});
|
|
10
|
-
const CMS_CLI_PACKAGE_NAME = '@hubspot/cms-cli';
|
|
11
|
-
export function notifyAboutUpdates() {
|
|
12
|
-
notifier.notify({
|
|
13
|
-
message: pkg.name === CMS_CLI_PACKAGE_NAME
|
|
14
|
-
? lib.middleware.updateNotification.cmsUpdateNotification(CMS_CLI_PACKAGE_NAME)
|
|
15
|
-
: lib.middleware.updateNotification.cliUpdateNotification,
|
|
16
|
-
defer: false,
|
|
17
|
-
boxenOptions: {
|
|
18
|
-
borderColor: UI_COLORS.MARIGOLD_DARK,
|
|
19
|
-
margin: 1,
|
|
20
|
-
padding: 1,
|
|
21
|
-
textAlignment: 'center',
|
|
22
|
-
borderStyle: 'round',
|
|
23
|
-
title: pkg.name === CMS_CLI_PACKAGE_NAME
|
|
24
|
-
? undefined
|
|
25
|
-
: lib.middleware.updateNotification.notifyTitle,
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
}
|
package/lib/ui/boxen.d.ts
DELETED
package/lib/ui/boxen.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { uiLogger } from './logger.js';
|
|
2
|
-
import { UI_COLORS } from './index.js';
|
|
3
|
-
import { lib } from '../../lang/en.js';
|
|
4
|
-
const defaultOptions = {
|
|
5
|
-
titleAlignment: 'left',
|
|
6
|
-
borderColor: UI_COLORS.MARIGOLD,
|
|
7
|
-
margin: 1,
|
|
8
|
-
padding: 1,
|
|
9
|
-
textAlignment: 'left',
|
|
10
|
-
borderStyle: 'round',
|
|
11
|
-
};
|
|
12
|
-
export async function logInBox({ contents, options, }) {
|
|
13
|
-
try {
|
|
14
|
-
const boxen = (await import('boxen')).default;
|
|
15
|
-
uiLogger.log(boxen(contents, { ...defaultOptions, ...options }));
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
catch (error) {
|
|
19
|
-
uiLogger.debug(lib.boxen.failedToLoad);
|
|
20
|
-
if (options?.title) {
|
|
21
|
-
uiLogger.log(options.title);
|
|
22
|
-
uiLogger.log('');
|
|
23
|
-
}
|
|
24
|
-
uiLogger.log(contents);
|
|
25
|
-
}
|
|
26
|
-
}
|