@hubspot/cli 8.14.0 → 8.15.0-beta.1
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/commands/cms/theme/preview.js +8 -1
- package/commands/getStarted.js +16 -21
- package/commands/project/add.js +7 -6
- package/commands/project/appInstallStatus.d.ts +1 -1
- package/commands/project/appInstallStatus.js +8 -4
- package/commands/project/create.js +24 -7
- package/commands/project/delete.js +1 -1
- package/commands/project/deploy.d.ts +1 -1
- package/commands/project/deploy.js +14 -12
- package/commands/project/dev/index.js +4 -7
- package/commands/project/download.d.ts +3 -2
- package/commands/project/download.js +18 -5
- package/commands/project/info.d.ts +1 -1
- package/commands/project/info.js +8 -5
- package/commands/project/installApp.d.ts +1 -1
- package/commands/project/installApp.js +9 -4
- package/commands/project/installDeps.js +6 -5
- package/commands/project/lint.js +16 -9
- package/commands/project/list.d.ts +3 -2
- package/commands/project/list.js +21 -3
- package/commands/project/listBuilds.d.ts +1 -1
- package/commands/project/listBuilds.js +4 -8
- package/commands/project/migrate.js +14 -19
- package/commands/project/open.js +15 -7
- package/commands/project/profile/add.js +8 -4
- package/commands/project/profile/delete.js +8 -4
- package/commands/project/release/create.d.ts +1 -1
- package/commands/project/release/create.js +5 -7
- package/commands/project/release/info.d.ts +1 -1
- package/commands/project/release/info.js +4 -4
- package/commands/project/release/list.d.ts +1 -1
- package/commands/project/release/list.js +4 -4
- package/commands/project/updateDeps.js +6 -5
- package/commands/project/upload.d.ts +1 -1
- package/commands/project/upload.js +26 -15
- package/commands/project/validate.d.ts +3 -2
- package/commands/project/validate.js +67 -97
- package/commands/project/watch.js +8 -11
- package/commands/project.js +1 -1
- package/commands/testAccount/create.d.ts +1 -1
- package/commands/testAccount/create.js +1 -1
- package/lang/en.d.ts +9 -19
- package/lang/en.js +9 -19
- package/lib/app/migrate.js +5 -7
- package/lib/constants.d.ts +0 -1
- package/lib/constants.js +0 -1
- package/lib/dependencyManagement.js +3 -10
- package/lib/doctor/DiagnosticInfoBuilder.d.ts +2 -2
- package/lib/doctor/DiagnosticInfoBuilder.js +8 -8
- package/lib/doctor/Doctor.js +7 -9
- package/lib/errors/ProjectErrors.d.ts +0 -6
- package/lib/errors/ProjectErrors.js +0 -12
- package/lib/errors/ProjectValidationError.d.ts +2 -1
- package/lib/errors/ProjectValidationError.js +3 -1
- package/lib/filesystem.d.ts +6 -0
- package/lib/filesystem.js +9 -0
- package/lib/getStartedV2Actions.js +14 -18
- package/lib/jsonOutput/appInstallStatus.d.ts +14 -0
- package/lib/jsonOutput/appInstallStatus.js +14 -0
- package/lib/jsonOutput/createTestAccount.d.ts +7 -0
- package/lib/jsonOutput/createTestAccount.js +6 -0
- package/lib/jsonOutput/deploy.d.ts +5 -0
- package/lib/jsonOutput/deploy.js +4 -0
- package/lib/jsonOutput/download.d.ts +7 -0
- package/lib/jsonOutput/download.js +6 -0
- package/lib/jsonOutput/info.d.ts +21 -0
- package/lib/jsonOutput/info.js +19 -0
- package/lib/jsonOutput/installApp.d.ts +11 -0
- package/lib/jsonOutput/installApp.js +10 -0
- package/lib/jsonOutput/listBuilds.d.ts +75 -0
- package/lib/jsonOutput/listBuilds.js +65 -0
- package/lib/jsonOutput/projectList.d.ts +29 -0
- package/lib/jsonOutput/projectList.js +28 -0
- package/lib/jsonOutput/release.d.ts +42 -0
- package/lib/jsonOutput/release.js +37 -0
- package/lib/jsonOutput/upload.d.ts +29 -0
- package/lib/jsonOutput/upload.js +23 -0
- package/lib/jsonOutput/validate.d.ts +36 -0
- package/lib/jsonOutput/validate.js +20 -0
- package/lib/npm/packageJson.js +1 -1
- package/lib/projects/ProjectLogsManager.js +1 -4
- package/lib/projects/config.d.ts +6 -5
- package/lib/projects/config.js +7 -38
- package/lib/projects/create/tracking.d.ts +1 -0
- package/lib/projects/create/tracking.js +27 -0
- package/lib/projects/delete.js +14 -1
- package/lib/projects/localDev/LocalDevProcess.js +7 -7
- package/lib/projects/projectProfiles.d.ts +3 -2
- package/lib/projects/projectProfiles.js +8 -3
- package/lib/projects/release.js +1 -1
- package/lib/projects/uieLinting.d.ts +2 -0
- package/lib/projects/uieLinting.js +13 -11
- package/lib/projects/upload.d.ts +5 -1
- package/lib/projects/upload.js +6 -1
- package/lib/projects/validate.d.ts +18 -0
- package/lib/projects/validate.js +142 -0
- package/lib/projects/validateLintConfigOnUpload.js +6 -5
- package/lib/projects/workspaces.js +6 -13
- package/lib/theme/migrate.js +1 -4
- package/mcp-server/tools/project/AddFeatureToProjectTool.d.ts +1 -1
- package/mcp-server/tools/project/CreateProjectTool.d.ts +1 -1
- package/mcp-server/tools/project/GetBuildLogsTool.js +2 -3
- package/mcp-server/tools/project/GetBuildStatusTool.js +2 -3
- package/mcp-server/tools/project/UploadProjectTools.js +3 -5
- package/mcp-server/tools/project/constants.d.ts +1 -1
- package/package.json +3 -3
- package/types/Projects.d.ts +1 -5
- package/lib/jsonOutput.d.ts +0 -182
- package/lib/jsonOutput.js +0 -158
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import stripAnsi from 'strip-ansi';
|
|
3
|
+
import { getAllHsProfiles } from '@hubspot/project-parsing-lib/profiles';
|
|
4
|
+
import { uiLogger } from '../ui/logger.js';
|
|
5
|
+
import SpinniesManager from '../ui/SpinniesManager.js';
|
|
6
|
+
import { logError, getErrorMessage } from '../errorHandlers/index.js';
|
|
7
|
+
import { commands } from '../../lang/en.js';
|
|
8
|
+
import { getProfileAccountId, validateProjectForProfile, } from './projectProfiles.js';
|
|
9
|
+
import { handleTranslate, validateSourceDirectory } from './upload.js';
|
|
10
|
+
export function toIssue(error, profile) {
|
|
11
|
+
const issue = {
|
|
12
|
+
message: stripAnsi(getErrorMessage(error)).trim(),
|
|
13
|
+
};
|
|
14
|
+
if (profile) {
|
|
15
|
+
issue.profile = profile;
|
|
16
|
+
}
|
|
17
|
+
return issue;
|
|
18
|
+
}
|
|
19
|
+
function logValidationErrors(validationErrors) {
|
|
20
|
+
uiLogger.log('');
|
|
21
|
+
validationErrors.forEach(error => {
|
|
22
|
+
if (error instanceof Error) {
|
|
23
|
+
logError(error);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
uiLogger.log(error);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
async function validateProfile({ projectConfig, projectDir, derivedAccountId, profileName, formatOutputAsJson, indentSpinners, }) {
|
|
31
|
+
const rawErrors = await validateProjectForProfile({
|
|
32
|
+
projectConfig,
|
|
33
|
+
projectDir,
|
|
34
|
+
profileName,
|
|
35
|
+
derivedAccountId,
|
|
36
|
+
...(indentSpinners ? { indentSpinners: true } : {}),
|
|
37
|
+
});
|
|
38
|
+
const accountId = formatOutputAsJson
|
|
39
|
+
? getProfileAccountId(projectConfig, projectDir, profileName)
|
|
40
|
+
: undefined;
|
|
41
|
+
const profile = {
|
|
42
|
+
name: profileName,
|
|
43
|
+
valid: rawErrors.length === 0,
|
|
44
|
+
};
|
|
45
|
+
if (accountId !== undefined) {
|
|
46
|
+
profile.accountId = accountId;
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
profile,
|
|
50
|
+
errors: rawErrors.map(e => toIssue(e, profileName)),
|
|
51
|
+
rawErrors,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export async function validateProject({ projectConfig, projectDir, derivedAccountId, profile, formatOutputAsJson, }) {
|
|
55
|
+
const errors = [];
|
|
56
|
+
const warnings = [];
|
|
57
|
+
const profiles = [];
|
|
58
|
+
let valid = true;
|
|
59
|
+
const srcDir = path.resolve(projectDir, projectConfig.srcDir);
|
|
60
|
+
const projectProfiles = await getAllHsProfiles(path.join(projectDir, projectConfig.srcDir));
|
|
61
|
+
if (profile) {
|
|
62
|
+
const result = await validateProfile({
|
|
63
|
+
projectConfig,
|
|
64
|
+
projectDir,
|
|
65
|
+
derivedAccountId,
|
|
66
|
+
profileName: profile,
|
|
67
|
+
formatOutputAsJson,
|
|
68
|
+
indentSpinners: false,
|
|
69
|
+
});
|
|
70
|
+
profiles.push(result.profile);
|
|
71
|
+
if (result.rawErrors.length) {
|
|
72
|
+
valid = false;
|
|
73
|
+
errors.push(...result.errors);
|
|
74
|
+
logValidationErrors(result.rawErrors);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
else if (projectProfiles.length > 0) {
|
|
78
|
+
SpinniesManager.add('validatingAllProfiles', {
|
|
79
|
+
text: commands.project.validate.spinners.validatingAllProfiles,
|
|
80
|
+
});
|
|
81
|
+
const rawErrors = [];
|
|
82
|
+
for (const profileName of projectProfiles) {
|
|
83
|
+
const result = await validateProfile({
|
|
84
|
+
projectConfig,
|
|
85
|
+
projectDir,
|
|
86
|
+
derivedAccountId,
|
|
87
|
+
profileName,
|
|
88
|
+
formatOutputAsJson,
|
|
89
|
+
indentSpinners: true,
|
|
90
|
+
});
|
|
91
|
+
profiles.push(result.profile);
|
|
92
|
+
if (result.rawErrors.length) {
|
|
93
|
+
valid = false;
|
|
94
|
+
errors.push(...result.errors);
|
|
95
|
+
}
|
|
96
|
+
rawErrors.push(...result.rawErrors);
|
|
97
|
+
}
|
|
98
|
+
if (valid) {
|
|
99
|
+
SpinniesManager.succeed('validatingAllProfiles', {
|
|
100
|
+
text: commands.project.validate.spinners.allProfilesValidationSucceeded,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
SpinniesManager.fail('validatingAllProfiles', {
|
|
105
|
+
text: commands.project.validate.spinners.allProfilesValidationFailed,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
logValidationErrors(rawErrors);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
try {
|
|
112
|
+
await handleTranslate({
|
|
113
|
+
projectDir,
|
|
114
|
+
projectConfig,
|
|
115
|
+
accountId: derivedAccountId,
|
|
116
|
+
skipValidation: false,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
catch (e) {
|
|
120
|
+
valid = false;
|
|
121
|
+
errors.push(toIssue(e));
|
|
122
|
+
uiLogger.error(commands.project.validate.failure(projectConfig.name));
|
|
123
|
+
logError(e);
|
|
124
|
+
uiLogger.log('');
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (valid) {
|
|
128
|
+
try {
|
|
129
|
+
const sourceWarnings = await validateSourceDirectory(srcDir, projectConfig, projectDir);
|
|
130
|
+
warnings.push(...sourceWarnings.map(warning => ({
|
|
131
|
+
message: stripAnsi(warning.message).trim(),
|
|
132
|
+
file: warning.file,
|
|
133
|
+
})));
|
|
134
|
+
}
|
|
135
|
+
catch (e) {
|
|
136
|
+
valid = false;
|
|
137
|
+
errors.push(toIssue(e));
|
|
138
|
+
logError(e);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return { valid, errors, warnings, profiles };
|
|
142
|
+
}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import { lib } from '../../lang/en.js';
|
|
3
3
|
import { uiLogger } from '../ui/logger.js';
|
|
4
|
-
import { areAllLintPackagesInstalled, hasEslintConfig, isHubSpotEslintConfigActive, } from './uieLinting.js';
|
|
4
|
+
import { areAllLintPackagesInstalled, hasEslintConfig, isHubSpotEslintConfigActive, isUieComponentDirectory, } from './uieLinting.js';
|
|
5
5
|
export async function validateLintConfigOnUpload({ srcDir, projectDir, parsedPackageJsons, isLegacyPlatform, }) {
|
|
6
6
|
const lintRoots = new Set();
|
|
7
7
|
if (isLegacyPlatform) {
|
|
8
8
|
lintRoots.add(srcDir);
|
|
9
9
|
}
|
|
10
10
|
else {
|
|
11
|
+
// Only check the directories that `hs project lint` actually covers,
|
|
12
|
+
// otherwise these warnings can never be resolved.
|
|
11
13
|
for (const { dir } of parsedPackageJsons) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
lintRoots.add(srcDir);
|
|
14
|
+
if (isUieComponentDirectory(dir, srcDir)) {
|
|
15
|
+
lintRoots.add(dir);
|
|
16
|
+
}
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
let hasAnyOutput = false;
|
|
@@ -4,6 +4,7 @@ import crypto from 'crypto';
|
|
|
4
4
|
import { shouldIgnoreFile } from '@hubspot/local-dev-lib/ignoreRules';
|
|
5
5
|
import { getPackableFiles, } from '@hubspot/project-parsing-lib/workspaces';
|
|
6
6
|
import { uiLogger } from '../ui/logger.js';
|
|
7
|
+
import { isPathInsideDirectory } from '../filesystem.js';
|
|
7
8
|
import { lib } from '../../lang/en.js';
|
|
8
9
|
const FILE_PROTOCOL_PREFIX = 'file:';
|
|
9
10
|
const LINK_PROTOCOL_PREFIX = 'link:';
|
|
@@ -62,14 +63,6 @@ export function computeExternalArchivePath(absolutePath, kind = KIND_DIRECTORY)
|
|
|
62
63
|
}
|
|
63
64
|
return path.posix.join('_workspaces', `${name}-${shortHash(resolved)}`);
|
|
64
65
|
}
|
|
65
|
-
/**
|
|
66
|
-
* Returns true if dir is inside srcDir (i.e. it will already be included
|
|
67
|
-
* in the archive from the srcDir walk and must not be copied again).
|
|
68
|
-
*/
|
|
69
|
-
function isInsideSrcDir(dir, srcDir) {
|
|
70
|
-
const rel = path.relative(path.resolve(srcDir), path.resolve(dir));
|
|
71
|
-
return !rel.startsWith('..') && !path.isAbsolute(rel);
|
|
72
|
-
}
|
|
73
66
|
/**
|
|
74
67
|
* Creates a file filter function for workspace archiving.
|
|
75
68
|
* Filters files based on packable files list and ignore rules.
|
|
@@ -108,7 +101,7 @@ async function archiveWorkspaceDirectories(archive, srcDir, workspaceMappings) {
|
|
|
108
101
|
if (!packageWorkspaceEntries.has(sourcePackageJsonPath)) {
|
|
109
102
|
packageWorkspaceEntries.set(sourcePackageJsonPath, []);
|
|
110
103
|
}
|
|
111
|
-
if (
|
|
104
|
+
if (isPathInsideDirectory(workspaceDir, srcDir)) {
|
|
112
105
|
// Internal: already in archive from srcDir walk.
|
|
113
106
|
// Store the relative path from the package.json directory so npm can resolve it.
|
|
114
107
|
const relPath = toPosixPath(path.relative(path.dirname(sourcePackageJsonPath), path.resolve(workspaceDir)));
|
|
@@ -161,7 +154,7 @@ async function archiveFileDependencies(archive, srcDir, fileDependencyMappings,
|
|
|
161
154
|
const toArchive = [];
|
|
162
155
|
for (const mapping of fileDependencyMappings) {
|
|
163
156
|
const { packageName, localPath, sourcePackageJsonPath, kind, protocol } = mapping;
|
|
164
|
-
if (
|
|
157
|
+
if (isPathInsideDirectory(localPath, srcDir)) {
|
|
165
158
|
continue;
|
|
166
159
|
}
|
|
167
160
|
const archivePath = computeExternalArchivePath(localPath, kind);
|
|
@@ -325,7 +318,7 @@ export function getPackageJsonPathsToUpdate(srcDir, workspaceMappings, fileDepen
|
|
|
325
318
|
paths.add(toPosixPath(path.relative(srcDir, sourcePackageJsonPath)));
|
|
326
319
|
}
|
|
327
320
|
for (const { localPath, sourcePackageJsonPath } of fileDependencyMappings) {
|
|
328
|
-
if (!
|
|
321
|
+
if (!isPathInsideDirectory(localPath, srcDir)) {
|
|
329
322
|
paths.add(toPosixPath(path.relative(srcDir, sourcePackageJsonPath)));
|
|
330
323
|
}
|
|
331
324
|
}
|
|
@@ -334,12 +327,12 @@ export function getPackageJsonPathsToUpdate(srcDir, workspaceMappings, fileDepen
|
|
|
334
327
|
function getDirsWithExternalDeps(srcDir, workspaceMappings, fileDependencyMappings) {
|
|
335
328
|
const dirs = new Set();
|
|
336
329
|
for (const { workspaceDir, sourcePackageJsonPath } of workspaceMappings) {
|
|
337
|
-
if (!
|
|
330
|
+
if (!isPathInsideDirectory(workspaceDir, srcDir)) {
|
|
338
331
|
dirs.add(path.dirname(sourcePackageJsonPath));
|
|
339
332
|
}
|
|
340
333
|
}
|
|
341
334
|
for (const { localPath, sourcePackageJsonPath } of fileDependencyMappings) {
|
|
342
|
-
if (!
|
|
335
|
+
if (!isPathInsideDirectory(localPath, srcDir)) {
|
|
343
336
|
dirs.add(path.dirname(sourcePackageJsonPath));
|
|
344
337
|
}
|
|
345
338
|
}
|
package/lib/theme/migrate.js
CHANGED
|
@@ -10,7 +10,7 @@ import { debugError } from '../errorHandlers/index.js';
|
|
|
10
10
|
import { confirmPrompt } from '../prompts/promptUtils.js';
|
|
11
11
|
import { fetchMigrationApps } from '../app/migrate.js';
|
|
12
12
|
export async function getHasMigratableThemes(projectConfig) {
|
|
13
|
-
if (!projectConfig
|
|
13
|
+
if (!projectConfig) {
|
|
14
14
|
return { hasMigratableThemes: false, migratableThemesCount: 0 };
|
|
15
15
|
}
|
|
16
16
|
const projectSrcDir = path.resolve(projectConfig.projectDir, projectConfig.projectConfig.srcDir);
|
|
@@ -29,9 +29,6 @@ export async function validateMigrationAppsAndThemes(hasApps, projectConfig) {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
export async function handleThemesMigration(projectConfig, platformVersion) {
|
|
32
|
-
if (!projectConfig?.projectDir || !projectConfig?.projectConfig?.srcDir) {
|
|
33
|
-
throw new Error(lib.migrate.errors.project.invalidConfig);
|
|
34
|
-
}
|
|
35
32
|
const projectSrcDir = path.resolve(projectConfig.projectDir, projectConfig.projectConfig.srcDir);
|
|
36
33
|
let migrated = false;
|
|
37
34
|
let failureReason;
|
|
@@ -18,9 +18,9 @@ declare const inputSchemaZodObject: z.ZodObject<{
|
|
|
18
18
|
features: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
19
19
|
card: "card";
|
|
20
20
|
settings: "settings";
|
|
21
|
+
"crm-bulk-action": "crm-bulk-action";
|
|
21
22
|
"app-event": "app-event";
|
|
22
23
|
"workflow-action-tool": "workflow-action-tool";
|
|
23
|
-
"crm-bulk-action": "crm-bulk-action";
|
|
24
24
|
page: "page";
|
|
25
25
|
webhooks: "webhooks";
|
|
26
26
|
"app-function": "app-function";
|
|
@@ -22,9 +22,9 @@ declare const inputSchemaZodObject: z.ZodObject<{
|
|
|
22
22
|
features: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
23
23
|
card: "card";
|
|
24
24
|
settings: "settings";
|
|
25
|
+
"crm-bulk-action": "crm-bulk-action";
|
|
25
26
|
"app-event": "app-event";
|
|
26
27
|
"workflow-action-tool": "workflow-action-tool";
|
|
27
|
-
"crm-bulk-action": "crm-bulk-action";
|
|
28
28
|
page: "page";
|
|
29
29
|
webhooks: "webhooks";
|
|
30
30
|
"app-function": "app-function";
|
|
@@ -3,7 +3,7 @@ import { z } from 'zod';
|
|
|
3
3
|
import { formatTextContents } from '../../utils/content.js';
|
|
4
4
|
import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
|
|
5
5
|
import { http } from '@hubspot/local-dev-lib/http';
|
|
6
|
-
import { getProjectConfig
|
|
6
|
+
import { getProjectConfig } from '../../../lib/projects/config.js';
|
|
7
7
|
import { absoluteCurrentWorkingDirectory, absoluteProjectPath, } from './constants.js';
|
|
8
8
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
9
9
|
import { discoverAccountTargets } from '../../../lib/accountTargetDiscovery.js';
|
|
@@ -64,8 +64,7 @@ export class GetBuildLogsTool extends Tool {
|
|
|
64
64
|
async handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, buildId, logLevel, }) {
|
|
65
65
|
setupHubSpotConfig(absoluteProjectPath);
|
|
66
66
|
try {
|
|
67
|
-
const { projectConfig, projectDir } =
|
|
68
|
-
validateProjectConfig(projectConfig, projectDir);
|
|
67
|
+
const { projectConfig, projectDir } = getProjectConfig(absoluteProjectPath);
|
|
69
68
|
const { recommended } = await discoverAccountTargets({
|
|
70
69
|
projectDir,
|
|
71
70
|
projectConfig,
|
|
@@ -3,7 +3,7 @@ import { z } from 'zod';
|
|
|
3
3
|
import { formatTextContents } from '../../utils/content.js';
|
|
4
4
|
import { isHubSpotHttpError } from '@hubspot/local-dev-lib/errors/index';
|
|
5
5
|
import { fetchProjectBuilds, getBuildStatus, } from '@hubspot/local-dev-lib/api/projects';
|
|
6
|
-
import { getProjectConfig
|
|
6
|
+
import { getProjectConfig } from '../../../lib/projects/config.js';
|
|
7
7
|
import moment from 'moment';
|
|
8
8
|
import { absoluteCurrentWorkingDirectory, absoluteProjectPath, } from './constants.js';
|
|
9
9
|
import { setupHubSpotConfig } from '../../utils/config.js';
|
|
@@ -109,8 +109,7 @@ export class GetBuildStatusTool extends Tool {
|
|
|
109
109
|
async handler({ absoluteProjectPath, absoluteCurrentWorkingDirectory, buildId, limit, }) {
|
|
110
110
|
setupHubSpotConfig(absoluteProjectPath);
|
|
111
111
|
try {
|
|
112
|
-
const { projectConfig, projectDir } =
|
|
113
|
-
validateProjectConfig(projectConfig, projectDir);
|
|
112
|
+
const { projectConfig, projectDir } = getProjectConfig(absoluteProjectPath);
|
|
114
113
|
const { recommended } = await discoverAccountTargets({
|
|
115
114
|
projectDir,
|
|
116
115
|
projectConfig,
|
|
@@ -41,11 +41,9 @@ export class UploadProjectTools extends Tool {
|
|
|
41
41
|
else {
|
|
42
42
|
let hasProfiles = false;
|
|
43
43
|
try {
|
|
44
|
-
const { projectConfig } =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
hasProfiles = profiles.length > 0;
|
|
48
|
-
}
|
|
44
|
+
const { projectConfig } = getProjectConfig(absoluteProjectPath);
|
|
45
|
+
const profiles = await getAllHsProfiles(path.join(absoluteProjectPath, projectConfig.srcDir));
|
|
46
|
+
hasProfiles = profiles.length > 0;
|
|
49
47
|
}
|
|
50
48
|
catch (e) {
|
|
51
49
|
this.logger.debug(toolName, {
|
|
@@ -4,9 +4,9 @@ export declare const absoluteCurrentWorkingDirectory: z.ZodString;
|
|
|
4
4
|
export declare const features: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
5
5
|
card: "card";
|
|
6
6
|
settings: "settings";
|
|
7
|
+
"crm-bulk-action": "crm-bulk-action";
|
|
7
8
|
"app-event": "app-event";
|
|
8
9
|
"workflow-action-tool": "workflow-action-tool";
|
|
9
|
-
"crm-bulk-action": "crm-bulk-action";
|
|
10
10
|
page: "page";
|
|
11
11
|
webhooks: "webhooks";
|
|
12
12
|
"app-function": "app-function";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cli",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.15.0-beta.1",
|
|
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",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"!**/__tests__/**"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@hubspot/local-dev-lib": "5.
|
|
14
|
-
"@hubspot/project-parsing-lib": "0.23.
|
|
13
|
+
"@hubspot/local-dev-lib": "5.11.0",
|
|
14
|
+
"@hubspot/project-parsing-lib": "0.23.3",
|
|
15
15
|
"@hubspot/ui-extensions-dev-server": "2.1.2",
|
|
16
16
|
"@inquirer/prompts": "7.1.0",
|
|
17
17
|
"@modelcontextprotocol/sdk": "1.29.0",
|
package/types/Projects.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Build, SubbuildStatus } from '@hubspot/local-dev-lib/types/Build';
|
|
2
2
|
import { Deploy, SubdeployStatus } from '@hubspot/local-dev-lib/types/Deploy';
|
|
3
3
|
import { appComponent, marketplaceDistribution, oAuth, privateDistribution, staticAuth } from '../lib/constants.js';
|
|
4
|
+
export type { ProjectConfig } from '@hubspot/project-parsing-lib/projects';
|
|
4
5
|
export type ProjectTemplate = {
|
|
5
6
|
name: string;
|
|
6
7
|
label: string;
|
|
@@ -20,11 +21,6 @@ export type ComponentTemplateChoice = {
|
|
|
20
21
|
value: ComponentTemplate;
|
|
21
22
|
disabled?: string | boolean;
|
|
22
23
|
};
|
|
23
|
-
export type ProjectConfig = {
|
|
24
|
-
name: string;
|
|
25
|
-
srcDir: string;
|
|
26
|
-
platformVersion: string;
|
|
27
|
-
};
|
|
28
24
|
export type ProjectTaskStates = {
|
|
29
25
|
BUILDING?: string;
|
|
30
26
|
ENQUEUED?: string;
|
package/lib/jsonOutput.d.ts
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { Build } from '@hubspot/local-dev-lib/types/Build';
|
|
3
|
-
import { Release } from '../api/releases.js';
|
|
4
|
-
declare const ReleaseComponentSchema: z.ZodObject<{
|
|
5
|
-
buildType: z.ZodString;
|
|
6
|
-
buildName: z.ZodOptional<z.ZodString>;
|
|
7
|
-
rootPath: z.ZodOptional<z.ZodString>;
|
|
8
|
-
id: z.ZodOptional<z.ZodString>;
|
|
9
|
-
}, z.core.$strip>;
|
|
10
|
-
export declare const ReleaseSchema: z.ZodObject<{
|
|
11
|
-
releaseTag: z.ZodString;
|
|
12
|
-
buildId: z.ZodNumber;
|
|
13
|
-
createdAt: z.ZodString;
|
|
14
|
-
components: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
15
|
-
buildType: z.ZodString;
|
|
16
|
-
buildName: z.ZodOptional<z.ZodString>;
|
|
17
|
-
rootPath: z.ZodOptional<z.ZodString>;
|
|
18
|
-
id: z.ZodOptional<z.ZodString>;
|
|
19
|
-
}, z.core.$strip>>>;
|
|
20
|
-
}, z.core.$strip>;
|
|
21
|
-
export declare const ReleaseListSchema: z.ZodObject<{
|
|
22
|
-
results: z.ZodArray<z.ZodObject<{
|
|
23
|
-
releaseTag: z.ZodString;
|
|
24
|
-
buildId: z.ZodNumber;
|
|
25
|
-
createdAt: z.ZodString;
|
|
26
|
-
components: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
27
|
-
buildType: z.ZodString;
|
|
28
|
-
buildName: z.ZodOptional<z.ZodString>;
|
|
29
|
-
rootPath: z.ZodOptional<z.ZodString>;
|
|
30
|
-
id: z.ZodOptional<z.ZodString>;
|
|
31
|
-
}, z.core.$strip>>>;
|
|
32
|
-
}, z.core.$strip>>;
|
|
33
|
-
paging: z.ZodOptional<z.ZodObject<{
|
|
34
|
-
next: z.ZodObject<{
|
|
35
|
-
after: z.ZodString;
|
|
36
|
-
}, z.core.$strip>;
|
|
37
|
-
}, z.core.$strip>>;
|
|
38
|
-
}, z.core.$strip>;
|
|
39
|
-
declare const BuildSubbuildStatusSchema: z.ZodObject<{
|
|
40
|
-
buildName: z.ZodString;
|
|
41
|
-
buildType: z.ZodString;
|
|
42
|
-
status: z.ZodString;
|
|
43
|
-
errorMessage: z.ZodOptional<z.ZodString>;
|
|
44
|
-
startedAt: z.ZodOptional<z.ZodString>;
|
|
45
|
-
finishedAt: z.ZodOptional<z.ZodString>;
|
|
46
|
-
rootPath: z.ZodOptional<z.ZodString>;
|
|
47
|
-
id: z.ZodOptional<z.ZodString>;
|
|
48
|
-
visible: z.ZodOptional<z.ZodBoolean>;
|
|
49
|
-
}, z.core.$strip>;
|
|
50
|
-
export declare const BuildSchema: z.ZodObject<{
|
|
51
|
-
buildId: z.ZodNumber;
|
|
52
|
-
status: z.ZodString;
|
|
53
|
-
isDeployed: z.ZodBoolean;
|
|
54
|
-
isAutoDeployEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
55
|
-
deployableState: z.ZodOptional<z.ZodString>;
|
|
56
|
-
platformVersion: z.ZodOptional<z.ZodString>;
|
|
57
|
-
uploadMessage: z.ZodOptional<z.ZodString>;
|
|
58
|
-
enqueuedAt: z.ZodOptional<z.ZodString>;
|
|
59
|
-
startedAt: z.ZodOptional<z.ZodString>;
|
|
60
|
-
finishedAt: z.ZodOptional<z.ZodString>;
|
|
61
|
-
createdAt: z.ZodOptional<z.ZodString>;
|
|
62
|
-
subbuildStatuses: z.ZodArray<z.ZodObject<{
|
|
63
|
-
buildName: z.ZodString;
|
|
64
|
-
buildType: z.ZodString;
|
|
65
|
-
status: z.ZodString;
|
|
66
|
-
errorMessage: z.ZodOptional<z.ZodString>;
|
|
67
|
-
startedAt: z.ZodOptional<z.ZodString>;
|
|
68
|
-
finishedAt: z.ZodOptional<z.ZodString>;
|
|
69
|
-
rootPath: z.ZodOptional<z.ZodString>;
|
|
70
|
-
id: z.ZodOptional<z.ZodString>;
|
|
71
|
-
visible: z.ZodOptional<z.ZodBoolean>;
|
|
72
|
-
}, z.core.$strip>>;
|
|
73
|
-
}, z.core.$strip>;
|
|
74
|
-
export declare const ProjectBuildsListSchema: z.ZodObject<{
|
|
75
|
-
projectName: z.ZodString;
|
|
76
|
-
deployedBuildId: z.ZodOptional<z.ZodNumber>;
|
|
77
|
-
results: z.ZodArray<z.ZodObject<{
|
|
78
|
-
buildId: z.ZodNumber;
|
|
79
|
-
status: z.ZodString;
|
|
80
|
-
isDeployed: z.ZodBoolean;
|
|
81
|
-
isAutoDeployEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
82
|
-
deployableState: z.ZodOptional<z.ZodString>;
|
|
83
|
-
platformVersion: z.ZodOptional<z.ZodString>;
|
|
84
|
-
uploadMessage: z.ZodOptional<z.ZodString>;
|
|
85
|
-
enqueuedAt: z.ZodOptional<z.ZodString>;
|
|
86
|
-
startedAt: z.ZodOptional<z.ZodString>;
|
|
87
|
-
finishedAt: z.ZodOptional<z.ZodString>;
|
|
88
|
-
createdAt: z.ZodOptional<z.ZodString>;
|
|
89
|
-
subbuildStatuses: z.ZodArray<z.ZodObject<{
|
|
90
|
-
buildName: z.ZodString;
|
|
91
|
-
buildType: z.ZodString;
|
|
92
|
-
status: z.ZodString;
|
|
93
|
-
errorMessage: z.ZodOptional<z.ZodString>;
|
|
94
|
-
startedAt: z.ZodOptional<z.ZodString>;
|
|
95
|
-
finishedAt: z.ZodOptional<z.ZodString>;
|
|
96
|
-
rootPath: z.ZodOptional<z.ZodString>;
|
|
97
|
-
id: z.ZodOptional<z.ZodString>;
|
|
98
|
-
visible: z.ZodOptional<z.ZodBoolean>;
|
|
99
|
-
}, z.core.$strip>>;
|
|
100
|
-
}, z.core.$strip>>;
|
|
101
|
-
paging: z.ZodOptional<z.ZodObject<{
|
|
102
|
-
next: z.ZodObject<{
|
|
103
|
-
after: z.ZodString;
|
|
104
|
-
}, z.core.$strip>;
|
|
105
|
-
}, z.core.$strip>>;
|
|
106
|
-
}, z.core.$strip>;
|
|
107
|
-
export declare const ProjectInfoSchema: z.ZodObject<{
|
|
108
|
-
projectName: z.ZodString;
|
|
109
|
-
platformVersion: z.ZodString;
|
|
110
|
-
projectId: z.ZodNumber;
|
|
111
|
-
deployedBuildId: z.ZodNumber;
|
|
112
|
-
autoDeployEnabled: z.ZodBoolean;
|
|
113
|
-
projectUrl: z.ZodOptional<z.ZodString>;
|
|
114
|
-
app: z.ZodOptional<z.ZodObject<{
|
|
115
|
-
name: z.ZodString;
|
|
116
|
-
id: z.ZodNumber;
|
|
117
|
-
uid: z.ZodString;
|
|
118
|
-
authType: z.ZodOptional<z.ZodString>;
|
|
119
|
-
distributionType: z.ZodOptional<z.ZodString>;
|
|
120
|
-
}, z.core.$strip>>;
|
|
121
|
-
components: z.ZodArray<z.ZodObject<{
|
|
122
|
-
uid: z.ZodString;
|
|
123
|
-
type: z.ZodString;
|
|
124
|
-
}, z.core.$strip>>;
|
|
125
|
-
}, z.core.$strip>;
|
|
126
|
-
declare const PreviewSchema: z.ZodObject<{
|
|
127
|
-
releaseTag: z.ZodOptional<z.ZodString>;
|
|
128
|
-
succeeded: z.ZodBoolean;
|
|
129
|
-
}, z.core.$strip>;
|
|
130
|
-
export declare const UploadSchema: z.ZodObject<{
|
|
131
|
-
buildId: z.ZodOptional<z.ZodNumber>;
|
|
132
|
-
deployId: z.ZodOptional<z.ZodNumber>;
|
|
133
|
-
preview: z.ZodOptional<z.ZodObject<{
|
|
134
|
-
releaseTag: z.ZodOptional<z.ZodString>;
|
|
135
|
-
succeeded: z.ZodBoolean;
|
|
136
|
-
}, z.core.$strip>>;
|
|
137
|
-
}, z.core.$strip>;
|
|
138
|
-
export declare const DeploySchema: z.ZodObject<{
|
|
139
|
-
deployId: z.ZodOptional<z.ZodNumber>;
|
|
140
|
-
}, z.core.$strip>;
|
|
141
|
-
export declare const InstallStatusSchema: z.ZodObject<{
|
|
142
|
-
appId: z.ZodOptional<z.ZodNumber>;
|
|
143
|
-
appUid: z.ZodString;
|
|
144
|
-
accountId: z.ZodNumber;
|
|
145
|
-
projectId: z.ZodNumber;
|
|
146
|
-
isInstalled: z.ZodBoolean;
|
|
147
|
-
isInstalledWithCurrentScopes: z.ZodBoolean;
|
|
148
|
-
previouslyAuthorizedScopeGroups: z.ZodArray<z.ZodObject<{
|
|
149
|
-
id: z.ZodNumber;
|
|
150
|
-
name: z.ZodString;
|
|
151
|
-
}, z.core.$strip>>;
|
|
152
|
-
}, z.core.$strip>;
|
|
153
|
-
export declare const InstallAppSchema: z.ZodObject<{
|
|
154
|
-
appId: z.ZodNumber;
|
|
155
|
-
appUid: z.ZodString;
|
|
156
|
-
accountId: z.ZodNumber;
|
|
157
|
-
projectId: z.ZodNumber;
|
|
158
|
-
installationState: z.ZodString;
|
|
159
|
-
installed: z.ZodBoolean;
|
|
160
|
-
reinstalled: z.ZodBoolean;
|
|
161
|
-
}, z.core.$strip>;
|
|
162
|
-
export declare const CreateTestAccountSchema: z.ZodObject<{
|
|
163
|
-
accountName: z.ZodOptional<z.ZodString>;
|
|
164
|
-
accountId: z.ZodOptional<z.ZodNumber>;
|
|
165
|
-
personalAccessKey: z.ZodOptional<z.ZodString>;
|
|
166
|
-
}, z.core.$strip>;
|
|
167
|
-
export type ReleaseComponentJsonOutput = z.infer<typeof ReleaseComponentSchema>;
|
|
168
|
-
export type ReleaseJsonOutput = z.infer<typeof ReleaseSchema>;
|
|
169
|
-
export type ReleaseListJsonOutput = z.infer<typeof ReleaseListSchema>;
|
|
170
|
-
export type BuildSubbuildStatusJsonOutput = z.infer<typeof BuildSubbuildStatusSchema>;
|
|
171
|
-
export type BuildJsonOutput = z.infer<typeof BuildSchema>;
|
|
172
|
-
export type ProjectBuildsListJsonOutput = z.infer<typeof ProjectBuildsListSchema>;
|
|
173
|
-
export type ProjectInfoJsonOutput = z.infer<typeof ProjectInfoSchema>;
|
|
174
|
-
export type PreviewJsonOutput = z.infer<typeof PreviewSchema>;
|
|
175
|
-
export type UploadJsonOutput = z.infer<typeof UploadSchema>;
|
|
176
|
-
export type DeployJsonOutput = z.infer<typeof DeploySchema>;
|
|
177
|
-
export type InstallStatusJsonOutput = z.infer<typeof InstallStatusSchema>;
|
|
178
|
-
export type InstallAppJsonOutput = z.infer<typeof InstallAppSchema>;
|
|
179
|
-
export type CreateTestAccountJsonOutput = z.infer<typeof CreateTestAccountSchema>;
|
|
180
|
-
export declare function mapBuildToJsonOutput(build: Build, deployedBuildId?: number): BuildJsonOutput;
|
|
181
|
-
export declare function mapReleaseToJsonOutput(release: Release): ReleaseJsonOutput;
|
|
182
|
-
export {};
|