@hubspot/cli 7.9.0-experimental.0 → 7.9.1-experimental.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/account/__tests__/rename.test.js +42 -0
- 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 +13 -18
- package/commands/account/remove.js +23 -22
- package/commands/account/removeOverride.js +6 -6
- package/commands/account/rename.d.ts +1 -1
- package/commands/account/rename.js +6 -3
- 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/config/set.js +1 -2
- package/commands/customObject/createSchema.js +2 -3
- package/commands/customObject/updateSchema.js +2 -3
- package/commands/getStarted.js +10 -5
- package/commands/hubdb/__tests__/list.test.js +1 -0
- package/commands/hubdb/list.js +2 -2
- package/commands/hubdb.d.ts +1 -1
- package/commands/init.js +36 -32
- package/commands/project/__tests__/deploy.test.js +10 -5
- package/commands/project/__tests__/devUnifiedFlow.test.js +6 -4
- 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/deploy.js +2 -2
- package/commands/project/dev/deprecatedFlow.js +4 -5
- package/commands/project/dev/index.js +14 -4
- package/commands/project/dev/unifiedFlow.js +4 -5
- package/commands/project/listBuilds.js +7 -1
- package/commands/project/logs.js +2 -3
- package/commands/project/profile/add.js +6 -7
- package/commands/project/profile/delete.js +2 -2
- package/commands/project/upload.js +9 -3
- package/commands/project/validate.js +9 -3
- package/commands/project/watch.js +7 -2
- 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/__tests__/create.test.js +68 -0
- package/commands/testAccount/create.d.ts +8 -0
- package/commands/testAccount/create.js +134 -44
- package/commands/testAccount/delete.js +9 -8
- package/commands/testAccount/importData.d.ts +1 -1
- package/lang/en.d.ts +3204 -3205
- package/lang/en.js +33 -9
- 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/constants.d.ts +1 -0
- package/lib/constants.js +6 -0
- 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/importData.js +8 -7
- package/lib/links.js +5 -5
- package/lib/mcp/__tests__/setup.test.js +127 -0
- package/lib/mcp/setup.d.ts +4 -12
- package/lib/mcp/setup.js +34 -1
- package/lib/middleware/__test__/commandTargetingUtils.test.js +3 -3
- package/lib/middleware/__test__/configMiddleware.test.js +23 -22
- package/lib/middleware/__test__/gitMiddleware.test.js +9 -7
- package/lib/middleware/autoUpdateMiddleware.d.ts +3 -1
- package/lib/middleware/autoUpdateMiddleware.js +10 -2
- package/lib/middleware/commandTargetingUtils.js +2 -2
- package/lib/middleware/configMiddleware.d.ts +6 -1
- package/lib/middleware/configMiddleware.js +36 -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 +148 -24
- package/lib/projects/__tests__/deploy.test.js +1 -0
- package/lib/projects/__tests__/projects.test.js +13 -42
- package/lib/projects/components.js +76 -20
- package/lib/projects/config.js +5 -9
- package/lib/projects/create/__tests__/v2.test.js +11 -0
- package/lib/projects/localDev/AppDevModeInterface.js +2 -2
- package/lib/projects/localDev/DevServerManager_DEPRECATED.js +2 -2
- 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/urls.js +5 -6
- package/lib/prompts/__tests__/createDeveloperTestAccountConfigPrompt.test.d.ts +1 -0
- package/lib/prompts/__tests__/createDeveloperTestAccountConfigPrompt.test.js +153 -0
- 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/createDeveloperTestAccountConfigPrompt.d.ts +5 -0
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +76 -66
- 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/index.js +6 -3
- package/lib/usageTracking.js +15 -8
- package/lib/validation.js +13 -11
- package/mcp-server/tools/cms/HsCreateFunctionTool.js +8 -2
- package/mcp-server/tools/cms/HsCreateModuleTool.d.ts +4 -4
- package/mcp-server/tools/cms/HsCreateModuleTool.js +8 -2
- package/mcp-server/tools/cms/HsCreateTemplateTool.js +8 -2
- package/mcp-server/tools/cms/HsFunctionLogsTool.d.ts +4 -4
- package/mcp-server/tools/cms/HsFunctionLogsTool.js +6 -2
- package/mcp-server/tools/cms/HsListFunctionsTool.js +5 -1
- package/mcp-server/tools/cms/HsListTool.js +5 -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.d.ts +1 -1
- package/mcp-server/tools/project/AddFeatureToProjectTool.js +9 -3
- package/mcp-server/tools/project/CreateProjectTool.js +8 -2
- package/mcp-server/tools/project/CreateTestAccountTool.d.ts +41 -0
- package/mcp-server/tools/project/CreateTestAccountTool.js +150 -0
- package/mcp-server/tools/project/DeployProjectTool.d.ts +1 -1
- package/mcp-server/tools/project/DeployProjectTool.js +8 -2
- package/mcp-server/tools/project/DocFetchTool.d.ts +1 -1
- package/mcp-server/tools/project/DocFetchTool.js +9 -5
- package/mcp-server/tools/project/DocsSearchTool.d.ts +1 -1
- package/mcp-server/tools/project/DocsSearchTool.js +12 -8
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +1 -1
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +11 -7
- package/mcp-server/tools/project/GetApplicationInfoTool.d.ts +1 -1
- package/mcp-server/tools/project/GetApplicationInfoTool.js +11 -7
- package/mcp-server/tools/project/GetBuildStatusTool.d.ts +26 -0
- package/mcp-server/tools/project/GetBuildStatusTool.js +164 -0
- package/mcp-server/tools/project/GetConfigValuesTool.d.ts +1 -1
- package/mcp-server/tools/project/GetConfigValuesTool.js +11 -7
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +1 -1
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +7 -3
- package/mcp-server/tools/project/UploadProjectTools.d.ts +9 -3
- package/mcp-server/tools/project/UploadProjectTools.js +51 -5
- package/mcp-server/tools/project/ValidateProjectTool.d.ts +1 -1
- package/mcp-server/tools/project/ValidateProjectTool.js +7 -3
- package/mcp-server/tools/project/__tests__/CreateTestAccountTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/CreateTestAccountTool.test.js +454 -0
- package/mcp-server/tools/project/__tests__/DocFetchTool.test.js +5 -1
- package/mcp-server/tools/project/__tests__/DocsSearchTool.test.js +25 -13
- 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__/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/tools/project/__tests__/UploadProjectTools.test.js +56 -4
- package/mcp-server/utils/__tests__/content.test.js +21 -20
- package/mcp-server/utils/__tests__/feedbackTracking.test.js +33 -28
- 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 +8 -7
- 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/{mcp-server/utils/__tests__/cliConfig.test.d.ts → lib/mcp/__tests__/setup.test.d.ts} +0 -0
|
@@ -1,82 +1,85 @@
|
|
|
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
8
|
vi.mock('../../../lib/hasFeature');
|
|
9
9
|
vi.mock('../../../lib/errorHandlers/index');
|
|
10
10
|
const mockGetStateValue = getStateValue;
|
|
11
11
|
const mockSetStateValue = setStateValue;
|
|
12
|
-
const
|
|
12
|
+
const mockGetConfigDefaultAccountIfExists = getConfigDefaultAccountIfExists;
|
|
13
13
|
const mockHasFeature = hasFeature;
|
|
14
14
|
describe('mcp-server/utils/feedbackTracking', () => {
|
|
15
|
-
const mockWorkingDirectory = '/test/working/directory';
|
|
16
15
|
beforeEach(() => {
|
|
17
16
|
vi.clearAllMocks();
|
|
18
17
|
});
|
|
19
18
|
describe('mcpFeedbackRequest', () => {
|
|
20
19
|
it('should return empty string when not at a threshold', async () => {
|
|
21
20
|
mockGetStateValue.mockReturnValue(10);
|
|
22
|
-
const result = await mcpFeedbackRequest(
|
|
21
|
+
const result = await mcpFeedbackRequest();
|
|
23
22
|
expect(mockSetStateValue).toHaveBeenCalledWith('mcpTotalToolCalls', 11);
|
|
24
23
|
expect(result).toBe(undefined);
|
|
25
24
|
});
|
|
26
25
|
it('should return feedback message at threshold 50', async () => {
|
|
27
26
|
mockGetStateValue.mockReturnValue(49);
|
|
28
|
-
|
|
29
|
-
const result = await mcpFeedbackRequest(
|
|
27
|
+
mockGetConfigDefaultAccountIfExists.mockReturnValue(undefined);
|
|
28
|
+
const result = await mcpFeedbackRequest();
|
|
30
29
|
expect(mockSetStateValue).toHaveBeenCalledWith('mcpTotalToolCalls', 50);
|
|
31
30
|
expect(result).toContain('FEEDBACK REQUEST');
|
|
32
31
|
expect(result).toContain('https://app.hubspot.com/l/product-updates/in-beta?rollout=239890');
|
|
33
32
|
});
|
|
34
33
|
it('should return feedback message at threshold 250', async () => {
|
|
35
34
|
mockGetStateValue.mockReturnValue(249);
|
|
36
|
-
|
|
37
|
-
const result = await mcpFeedbackRequest(
|
|
35
|
+
mockGetConfigDefaultAccountIfExists.mockReturnValue(undefined);
|
|
36
|
+
const result = await mcpFeedbackRequest();
|
|
38
37
|
expect(mockSetStateValue).toHaveBeenCalledWith('mcpTotalToolCalls', 250);
|
|
39
38
|
expect(result).toContain('FEEDBACK REQUEST');
|
|
40
39
|
});
|
|
41
40
|
it('should return feedback message at threshold 550', async () => {
|
|
42
41
|
mockGetStateValue.mockReturnValue(549);
|
|
43
|
-
|
|
44
|
-
const result = await mcpFeedbackRequest(
|
|
42
|
+
mockGetConfigDefaultAccountIfExists.mockReturnValue(undefined);
|
|
43
|
+
const result = await mcpFeedbackRequest();
|
|
45
44
|
expect(mockSetStateValue).toHaveBeenCalledWith('mcpTotalToolCalls', 550);
|
|
46
45
|
expect(result).toContain('FEEDBACK REQUEST');
|
|
47
46
|
});
|
|
48
47
|
it('should return feedback message at threshold 1050', async () => {
|
|
49
48
|
mockGetStateValue.mockReturnValue(1049);
|
|
50
|
-
|
|
51
|
-
const result = await mcpFeedbackRequest(
|
|
49
|
+
mockGetConfigDefaultAccountIfExists.mockReturnValue(undefined);
|
|
50
|
+
const result = await mcpFeedbackRequest();
|
|
52
51
|
expect(mockSetStateValue).toHaveBeenCalledWith('mcpTotalToolCalls', 1050);
|
|
53
52
|
expect(result).toContain('FEEDBACK REQUEST');
|
|
54
53
|
});
|
|
55
54
|
it('should use account-specific URL when account has MCP access', async () => {
|
|
56
55
|
const accountId = 12345;
|
|
57
56
|
mockGetStateValue.mockReturnValue(49);
|
|
58
|
-
|
|
57
|
+
mockGetConfigDefaultAccountIfExists.mockReturnValue({
|
|
58
|
+
accountId,
|
|
59
|
+
});
|
|
59
60
|
mockHasFeature.mockResolvedValue(true);
|
|
60
|
-
const result = await mcpFeedbackRequest(
|
|
61
|
-
expect(
|
|
61
|
+
const result = await mcpFeedbackRequest();
|
|
62
|
+
expect(mockGetConfigDefaultAccountIfExists).toHaveBeenCalled();
|
|
62
63
|
expect(mockHasFeature).toHaveBeenCalledWith(accountId, FEATURES.MCP_ACCESS);
|
|
63
64
|
expect(result).toContain(`https://app.hubspot.com/product-updates/${accountId}/in-beta?rollout=239890`);
|
|
64
65
|
});
|
|
65
66
|
it('should use default URL when account does not have MCP access', async () => {
|
|
66
67
|
const accountId = 12345;
|
|
67
68
|
mockGetStateValue.mockReturnValue(49);
|
|
68
|
-
|
|
69
|
+
mockGetConfigDefaultAccountIfExists.mockReturnValue({
|
|
70
|
+
accountId,
|
|
71
|
+
});
|
|
69
72
|
mockHasFeature.mockResolvedValue(false);
|
|
70
|
-
const result = await mcpFeedbackRequest(
|
|
73
|
+
const result = await mcpFeedbackRequest();
|
|
71
74
|
expect(mockHasFeature).toHaveBeenCalledWith(accountId, FEATURES.MCP_ACCESS);
|
|
72
75
|
expect(result).toContain('https://app.hubspot.com/l/product-updates/in-beta?rollout=239890');
|
|
73
76
|
expect(result).not.toContain(`/product-updates/${accountId}/`);
|
|
74
77
|
});
|
|
75
78
|
it('should use default URL when no account ID is found', async () => {
|
|
76
79
|
mockGetStateValue.mockReturnValue(49);
|
|
77
|
-
|
|
78
|
-
const result = await mcpFeedbackRequest(
|
|
79
|
-
expect(
|
|
80
|
+
mockGetConfigDefaultAccountIfExists.mockReturnValue(undefined);
|
|
81
|
+
const result = await mcpFeedbackRequest();
|
|
82
|
+
expect(mockGetConfigDefaultAccountIfExists).toHaveBeenCalled();
|
|
80
83
|
expect(mockHasFeature).not.toHaveBeenCalled();
|
|
81
84
|
expect(result).toContain('https://app.hubspot.com/l/product-updates/in-beta?rollout=239890');
|
|
82
85
|
});
|
|
@@ -84,35 +87,37 @@ describe('mcp-server/utils/feedbackTracking', () => {
|
|
|
84
87
|
mockGetStateValue.mockImplementation(() => {
|
|
85
88
|
throw new Error('State error');
|
|
86
89
|
});
|
|
87
|
-
const result = await mcpFeedbackRequest(
|
|
90
|
+
const result = await mcpFeedbackRequest();
|
|
88
91
|
expect(result).toBe(undefined);
|
|
89
92
|
});
|
|
90
93
|
it('should handle hasFeature errors and use default URL', async () => {
|
|
91
94
|
const accountId = 12345;
|
|
92
95
|
mockGetStateValue.mockReturnValue(49);
|
|
93
|
-
|
|
96
|
+
mockGetConfigDefaultAccountIfExists.mockReturnValue({
|
|
97
|
+
accountId,
|
|
98
|
+
});
|
|
94
99
|
mockHasFeature.mockRejectedValue(new Error('Feature check failed'));
|
|
95
|
-
const result = await mcpFeedbackRequest(
|
|
100
|
+
const result = await mcpFeedbackRequest();
|
|
96
101
|
expect(result).toContain('https://app.hubspot.com/l/product-updates/in-beta?rollout=239890');
|
|
97
102
|
expect(result).not.toContain(`/product-updates/${accountId}/`);
|
|
98
103
|
});
|
|
99
104
|
it('should not return feedback at threshold + 1', async () => {
|
|
100
105
|
mockGetStateValue.mockReturnValue(50);
|
|
101
|
-
const result = await mcpFeedbackRequest(
|
|
106
|
+
const result = await mcpFeedbackRequest();
|
|
102
107
|
expect(mockSetStateValue).toHaveBeenCalledWith('mcpTotalToolCalls', 51);
|
|
103
108
|
expect(result).toBe(undefined);
|
|
104
109
|
});
|
|
105
110
|
it('should increment tool calls counter on every invocation', async () => {
|
|
106
111
|
const initialCount = 100;
|
|
107
112
|
mockGetStateValue.mockReturnValue(initialCount);
|
|
108
|
-
await mcpFeedbackRequest(
|
|
113
|
+
await mcpFeedbackRequest();
|
|
109
114
|
expect(mockGetStateValue).toHaveBeenCalledWith('mcpTotalToolCalls');
|
|
110
115
|
expect(mockSetStateValue).toHaveBeenCalledWith('mcpTotalToolCalls', initialCount + 1);
|
|
111
116
|
});
|
|
112
117
|
it('should include feedback request instructions in message', async () => {
|
|
113
118
|
mockGetStateValue.mockReturnValue(49);
|
|
114
|
-
|
|
115
|
-
const result = await mcpFeedbackRequest(
|
|
119
|
+
mockGetConfigDefaultAccountIfExists.mockReturnValue(undefined);
|
|
120
|
+
const result = await mcpFeedbackRequest();
|
|
116
121
|
expect(result).toContain('IMPORTANT - FEEDBACK REQUEST');
|
|
117
122
|
expect(result).toContain('This message appears only once');
|
|
118
123
|
expect(result).toContain('Share feedback here');
|
|
@@ -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,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cli",
|
|
3
|
-
"version": "7.9.
|
|
3
|
+
"version": "7.9.1-experimental.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.0",
|
|
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.0",
|
|
14
14
|
"archiver": "7.0.1",
|
|
15
15
|
"boxen": "8.0.1",
|
|
16
16
|
"chalk": "5.4.1",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"vitest": "^2.1.9"
|
|
69
69
|
},
|
|
70
70
|
"optionalDependencies": {
|
|
71
|
-
"@hubspot/cms-dev-server": "^1.
|
|
71
|
+
"@hubspot/cms-dev-server": "^1.2.1",
|
|
72
72
|
"@modelcontextprotocol/sdk": "1.13.3"
|
|
73
73
|
},
|
|
74
74
|
"scripts": {
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
"test-cli-debug": "yarn build && yarn --cwd 'acceptance-tests' test-debug",
|
|
93
93
|
"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
94
|
"test-cli-qa": "yarn build && yarn --cwd 'acceptance-tests' test-qa",
|
|
95
|
+
"test-cli-qa-debug": "yarn build && yarn --cwd 'acceptance-tests' test-qa-debug",
|
|
95
96
|
"update-ldl": "yarn add --exact @hubspot/local-dev-lib@latest",
|
|
96
97
|
"view-unreleased-changes": "node ./scripts/unreleasedChanges.js"
|
|
97
98
|
},
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { getAccountIdFromCliConfig } from '../cliConfig.js';
|
|
2
|
-
import { configFileExists, findConfig, getAccountId, loadConfig, } from '@hubspot/local-dev-lib/config';
|
|
3
|
-
vi.mock('@hubspot/local-dev-lib/config');
|
|
4
|
-
const mockConfigFileExists = configFileExists;
|
|
5
|
-
const mockFindConfig = findConfig;
|
|
6
|
-
const mockGetAccountId = getAccountId;
|
|
7
|
-
const mockLoadConfig = loadConfig;
|
|
8
|
-
describe('mcp-server/utils/cliConfig', () => {
|
|
9
|
-
const mockWorkingDirectory = '/test/working/directory';
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
vi.clearAllMocks();
|
|
12
|
-
});
|
|
13
|
-
describe('getAccountIdFromCliConfig', () => {
|
|
14
|
-
it('should load global config when it exists and return account ID', () => {
|
|
15
|
-
const expectedAccountId = 12345;
|
|
16
|
-
mockConfigFileExists.mockReturnValue(true);
|
|
17
|
-
mockGetAccountId.mockReturnValue(expectedAccountId);
|
|
18
|
-
const result = getAccountIdFromCliConfig(mockWorkingDirectory);
|
|
19
|
-
expect(mockConfigFileExists).toHaveBeenCalledWith(true);
|
|
20
|
-
expect(mockLoadConfig).toHaveBeenCalledWith('');
|
|
21
|
-
expect(mockFindConfig).not.toHaveBeenCalled();
|
|
22
|
-
expect(mockGetAccountId).toHaveBeenCalledWith(undefined);
|
|
23
|
-
expect(result).toBe(expectedAccountId);
|
|
24
|
-
});
|
|
25
|
-
it('should load local config when global config does not exist and return account ID', () => {
|
|
26
|
-
const expectedAccountId = 67890;
|
|
27
|
-
const localConfigPath = '/path/to/local/config';
|
|
28
|
-
mockConfigFileExists.mockReturnValue(false);
|
|
29
|
-
mockFindConfig.mockReturnValue(localConfigPath);
|
|
30
|
-
mockGetAccountId.mockReturnValue(expectedAccountId);
|
|
31
|
-
const result = getAccountIdFromCliConfig(mockWorkingDirectory);
|
|
32
|
-
expect(mockConfigFileExists).toHaveBeenCalledWith(true);
|
|
33
|
-
expect(mockFindConfig).toHaveBeenCalledWith(mockWorkingDirectory);
|
|
34
|
-
expect(mockLoadConfig).toHaveBeenCalledWith(localConfigPath);
|
|
35
|
-
expect(mockGetAccountId).toHaveBeenCalledWith(undefined);
|
|
36
|
-
expect(result).toBe(expectedAccountId);
|
|
37
|
-
});
|
|
38
|
-
it('should pass accountNameOrId parameter to getAccountId when provided as string', () => {
|
|
39
|
-
const expectedAccountId = 11111;
|
|
40
|
-
const accountName = 'test-account';
|
|
41
|
-
mockConfigFileExists.mockReturnValue(true);
|
|
42
|
-
mockGetAccountId.mockReturnValue(expectedAccountId);
|
|
43
|
-
const result = getAccountIdFromCliConfig(mockWorkingDirectory, accountName);
|
|
44
|
-
expect(mockConfigFileExists).toHaveBeenCalledWith(true);
|
|
45
|
-
expect(mockLoadConfig).toHaveBeenCalledWith('');
|
|
46
|
-
expect(mockGetAccountId).toHaveBeenCalledWith(accountName);
|
|
47
|
-
expect(result).toBe(expectedAccountId);
|
|
48
|
-
});
|
|
49
|
-
it('should pass accountNameOrId parameter to getAccountId when provided as number', () => {
|
|
50
|
-
const expectedAccountId = 22222;
|
|
51
|
-
const accountId = 22222;
|
|
52
|
-
mockConfigFileExists.mockReturnValue(true);
|
|
53
|
-
mockGetAccountId.mockReturnValue(expectedAccountId);
|
|
54
|
-
const result = getAccountIdFromCliConfig(mockWorkingDirectory, accountId);
|
|
55
|
-
expect(mockConfigFileExists).toHaveBeenCalledWith(true);
|
|
56
|
-
expect(mockLoadConfig).toHaveBeenCalledWith('');
|
|
57
|
-
expect(mockGetAccountId).toHaveBeenCalledWith(accountId);
|
|
58
|
-
expect(result).toBe(expectedAccountId);
|
|
59
|
-
});
|
|
60
|
-
it('should return null when getAccountId returns null', () => {
|
|
61
|
-
mockConfigFileExists.mockReturnValue(true);
|
|
62
|
-
mockGetAccountId.mockReturnValue(null);
|
|
63
|
-
const result = getAccountIdFromCliConfig(mockWorkingDirectory);
|
|
64
|
-
expect(mockConfigFileExists).toHaveBeenCalledWith(true);
|
|
65
|
-
expect(mockLoadConfig).toHaveBeenCalledWith('');
|
|
66
|
-
expect(mockGetAccountId).toHaveBeenCalledWith(undefined);
|
|
67
|
-
expect(result).toBeNull();
|
|
68
|
-
});
|
|
69
|
-
it('should handle findConfig returning null by passing null to loadConfig', () => {
|
|
70
|
-
const expectedAccountId = 33333;
|
|
71
|
-
mockConfigFileExists.mockReturnValue(false);
|
|
72
|
-
mockFindConfig.mockReturnValue(null);
|
|
73
|
-
mockGetAccountId.mockReturnValue(expectedAccountId);
|
|
74
|
-
const result = getAccountIdFromCliConfig(mockWorkingDirectory);
|
|
75
|
-
expect(mockConfigFileExists).toHaveBeenCalledWith(true);
|
|
76
|
-
expect(mockFindConfig).toHaveBeenCalledWith(mockWorkingDirectory);
|
|
77
|
-
expect(mockLoadConfig).toHaveBeenCalledWith(null);
|
|
78
|
-
expect(mockGetAccountId).toHaveBeenCalledWith(undefined);
|
|
79
|
-
expect(result).toBe(expectedAccountId);
|
|
80
|
-
});
|
|
81
|
-
it('should work with local config when provided with account name parameter', () => {
|
|
82
|
-
const expectedAccountId = 44444;
|
|
83
|
-
const accountName = 'local-test-account';
|
|
84
|
-
const localConfigPath = '/path/to/local/config';
|
|
85
|
-
mockConfigFileExists.mockReturnValue(false);
|
|
86
|
-
mockFindConfig.mockReturnValue(localConfigPath);
|
|
87
|
-
mockGetAccountId.mockReturnValue(expectedAccountId);
|
|
88
|
-
const result = getAccountIdFromCliConfig(mockWorkingDirectory, accountName);
|
|
89
|
-
expect(mockConfigFileExists).toHaveBeenCalledWith(true);
|
|
90
|
-
expect(mockFindConfig).toHaveBeenCalledWith(mockWorkingDirectory);
|
|
91
|
-
expect(mockLoadConfig).toHaveBeenCalledWith(localConfigPath);
|
|
92
|
-
expect(mockGetAccountId).toHaveBeenCalledWith(accountName);
|
|
93
|
-
expect(result).toBe(expectedAccountId);
|
|
94
|
-
});
|
|
95
|
-
it('should work with local config when provided with account ID parameter', () => {
|
|
96
|
-
const expectedAccountId = 55555;
|
|
97
|
-
const accountId = 55555;
|
|
98
|
-
const localConfigPath = '/path/to/local/config';
|
|
99
|
-
mockConfigFileExists.mockReturnValue(false);
|
|
100
|
-
mockFindConfig.mockReturnValue(localConfigPath);
|
|
101
|
-
mockGetAccountId.mockReturnValue(expectedAccountId);
|
|
102
|
-
const result = getAccountIdFromCliConfig(mockWorkingDirectory, accountId);
|
|
103
|
-
expect(mockConfigFileExists).toHaveBeenCalledWith(true);
|
|
104
|
-
expect(mockFindConfig).toHaveBeenCalledWith(mockWorkingDirectory);
|
|
105
|
-
expect(mockLoadConfig).toHaveBeenCalledWith(localConfigPath);
|
|
106
|
-
expect(mockGetAccountId).toHaveBeenCalledWith(accountId);
|
|
107
|
-
expect(result).toBe(expectedAccountId);
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getAccountIdFromCliConfig(absolutePathToWorkingDirectory: string, accountNameOrId?: string | number): number | null;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { configFileExists, findConfig, getAccountId, loadConfig, } from '@hubspot/local-dev-lib/config';
|
|
2
|
-
export function getAccountIdFromCliConfig(absolutePathToWorkingDirectory, accountNameOrId) {
|
|
3
|
-
const globalConfigExists = configFileExists(true);
|
|
4
|
-
if (globalConfigExists) {
|
|
5
|
-
loadConfig('');
|
|
6
|
-
}
|
|
7
|
-
else {
|
|
8
|
-
const configPath = findConfig(absolutePathToWorkingDirectory);
|
|
9
|
-
loadConfig(configPath);
|
|
10
|
-
}
|
|
11
|
-
return getAccountId(accountNameOrId);
|
|
12
|
-
}
|
/package/{mcp-server/utils/__tests__/cliConfig.test.d.ts → lib/mcp/__tests__/setup.test.d.ts}
RENAMED
|
File without changes
|