@hubspot/cli 8.0.0 → 8.0.2-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.
Files changed (49) hide show
  1. package/bin/cli.js +8 -5
  2. package/commands/__tests__/getStarted.test.js +12 -0
  3. package/commands/getStarted.d.ts +2 -1
  4. package/commands/getStarted.js +38 -15
  5. package/lang/en.d.ts +31 -5
  6. package/lang/en.js +33 -7
  7. package/lib/CLIWebSocketServer.d.ts +28 -0
  8. package/lib/CLIWebSocketServer.js +91 -0
  9. package/lib/__tests__/CLIWebSocketServer.test.d.ts +1 -0
  10. package/lib/__tests__/CLIWebSocketServer.test.js +252 -0
  11. package/lib/__tests__/commandSuggestion.test.d.ts +1 -0
  12. package/lib/__tests__/commandSuggestion.test.js +119 -0
  13. package/lib/commandSuggestion.d.ts +3 -0
  14. package/lib/commandSuggestion.js +45 -0
  15. package/lib/constants.d.ts +0 -1
  16. package/lib/constants.js +0 -1
  17. package/lib/getStarted/getStartedV2.d.ts +7 -0
  18. package/lib/getStarted/getStartedV2.js +56 -0
  19. package/lib/getStartedV2Actions.d.ts +8 -0
  20. package/lib/getStartedV2Actions.js +51 -0
  21. package/lib/mcp/setup.js +48 -54
  22. package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +43 -175
  23. package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +2 -7
  24. package/lib/projects/localDev/LocalDevWebsocketServer.js +51 -98
  25. package/lib/projects/localDev/localDevWebsocketServerUtils.d.ts +8 -7
  26. package/lib/projects/platformVersion.js +1 -1
  27. package/package.json +9 -4
  28. package/types/LocalDev.d.ts +0 -4
  29. package/ui/components/ActionSection.d.ts +12 -0
  30. package/ui/components/ActionSection.js +25 -0
  31. package/ui/components/BoxWithTitle.d.ts +4 -2
  32. package/ui/components/BoxWithTitle.js +2 -2
  33. package/ui/components/FullScreen.d.ts +6 -0
  34. package/ui/components/FullScreen.js +13 -0
  35. package/ui/components/GetStartedFlow.d.ts +24 -0
  36. package/ui/components/GetStartedFlow.js +128 -0
  37. package/ui/components/InputField.d.ts +10 -0
  38. package/ui/components/InputField.js +10 -0
  39. package/ui/components/SelectInput.d.ts +11 -0
  40. package/ui/components/SelectInput.js +59 -0
  41. package/ui/components/StatusIcon.d.ts +9 -0
  42. package/ui/components/StatusIcon.js +17 -0
  43. package/ui/constants.d.ts +6 -0
  44. package/ui/constants.js +6 -0
  45. package/ui/playground/fixtures.js +47 -0
  46. package/ui/render.d.ts +4 -0
  47. package/ui/render.js +25 -0
  48. package/ui/styles.d.ts +3 -0
  49. package/ui/styles.js +3 -0
@@ -0,0 +1,9 @@
1
+ import { ValueOf } from '@hubspot/local-dev-lib/types/Utils';
2
+ import { ACTION_STATUSES } from '../constants.js';
3
+ type ActionStatus = ValueOf<typeof ACTION_STATUSES>;
4
+ export type StatusIconProps = {
5
+ status: ActionStatus;
6
+ };
7
+ export declare function StatusIcon({ status }: StatusIconProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function getStatusIcon(props: StatusIconProps): React.ReactNode;
9
+ export {};
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Text } from 'ink';
3
+ import Spinner from 'ink-spinner';
4
+ import { ACTION_STATUSES } from '../constants.js';
5
+ import { INK_COLORS } from '../styles.js';
6
+ export function StatusIcon({ status }) {
7
+ if (status === ACTION_STATUSES.ERROR) {
8
+ return _jsx(Text, { color: INK_COLORS.ALERT_RED, children: "\u00D7" });
9
+ }
10
+ if (status === ACTION_STATUSES.DONE) {
11
+ return _jsx(Text, { color: INK_COLORS.HUBSPOT_TEAL, children: "\u2713" });
12
+ }
13
+ return (_jsx(Text, { color: INK_COLORS.HUBSPOT_TEAL, children: _jsx(Spinner, { type: "dots" }) }));
14
+ }
15
+ export function getStatusIcon(props) {
16
+ return _jsx(StatusIcon, { ...props });
17
+ }
@@ -0,0 +1,6 @@
1
+ export declare const ACTION_STATUSES: {
2
+ readonly IDLE: "idle";
3
+ readonly RUNNING: "running";
4
+ readonly DONE: "done";
5
+ readonly ERROR: "error";
6
+ };
@@ -0,0 +1,6 @@
1
+ export const ACTION_STATUSES = {
2
+ IDLE: 'idle',
3
+ RUNNING: 'running',
4
+ DONE: 'done',
5
+ ERROR: 'error',
6
+ };
@@ -1,8 +1,19 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
1
2
  import { getSuccessBox, getInfoBox, getWarningBox, getAlertBox, } from '../components/StatusMessageBoxes.js';
2
3
  import { getBoxWithTitle } from '../components/BoxWithTitle.js';
3
4
  import { getTable } from '../components/Table.js';
5
+ import { getActionSection } from '../components/ActionSection.js';
6
+ import { getInputField } from '../components/InputField.js';
7
+ import { getSelectInput } from '../components/SelectInput.js';
8
+ import { getStatusIcon } from '../components/StatusIcon.js';
4
9
  import { SuccessBox, InfoBox, WarningBox, AlertBox, } from '../components/StatusMessageBoxes.js';
5
10
  import { BoxWithTitle } from '../components/BoxWithTitle.js';
11
+ import { ActionSection } from '../components/ActionSection.js';
12
+ import { InputField } from '../components/InputField.js';
13
+ import { SelectInput } from '../components/SelectInput.js';
14
+ import { StatusIcon } from '../components/StatusIcon.js';
15
+ import { ACTION_STATUSES } from '../constants.js';
16
+ import { Text } from 'ink';
6
17
  /**
7
18
  * These components will be used by the playground. Please add any new components here.
8
19
  */
@@ -73,6 +84,42 @@ export const populatedComponents = {
73
84
  }),
74
85
  signature: '',
75
86
  },
87
+ ActionSection: {
88
+ component: getActionSection({
89
+ status: ACTION_STATUSES.DONE,
90
+ statusText: 'Action completed successfully',
91
+ children: _jsx(Text, { children: "This is an action section" }),
92
+ }),
93
+ signature: ActionSection.toString(),
94
+ },
95
+ InputField: {
96
+ component: getInputField({
97
+ flag: 'name',
98
+ prompt: 'Enter your name',
99
+ value: 'example',
100
+ isEditing: false,
101
+ onChange: () => { },
102
+ onSubmit: () => { },
103
+ }),
104
+ signature: InputField.toString(),
105
+ },
106
+ SelectInput: {
107
+ component: getSelectInput({
108
+ items: [
109
+ { label: 'Option 1', value: 'option1' },
110
+ { label: 'Option 2', value: 'option2' },
111
+ { label: 'Option 3', value: 'option3' },
112
+ ],
113
+ onSelect: () => { },
114
+ }),
115
+ signature: SelectInput.toString(),
116
+ },
117
+ StatusIcon: {
118
+ component: getStatusIcon({
119
+ status: ACTION_STATUSES.DONE,
120
+ }),
121
+ signature: StatusIcon.toString(),
122
+ },
76
123
  };
77
124
  export function getComponentOptions() {
78
125
  return Object.keys(populatedComponents);
package/ui/render.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Scalar } from './components/Table.js';
2
+ import { ReactNode } from 'react';
2
3
  /**
3
4
  * Renders an Ink component to stdout and immediately unmounts.
4
5
  * Uses a proxy to report large viewport dimensions, preventing Ink from clipping output.
@@ -17,3 +18,6 @@ export declare function renderTable(tableHeaders: string[], tableData: Scalar[][
17
18
  * @param items - 2D array where each inner array is a row (typically single-item arrays for a simple list).
18
19
  */
19
20
  export declare function renderList(items: string[][]): Promise<void>;
21
+ export declare function renderInteractive(component: ReactNode, options?: {
22
+ fullScreen?: boolean;
23
+ }): Promise<void>;
package/ui/render.js CHANGED
@@ -1,6 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
1
2
  import { render } from 'ink';
2
3
  import { getTable } from './components/Table.js';
3
4
  import { mapTableDataToObjects } from './lib/table.js';
5
+ import { FullScreen } from './components/FullScreen.js';
4
6
  // Ink 6 clips output when it exceeds stdout.rows — we can use a large row count to prevent this.
5
7
  // This value is arbitrary but large enough to prevent clipping for any realistic static output.
6
8
  const INK_VIEWPORT_ROWS_FOR_STATIC_OUTPUT = 1000;
@@ -42,3 +44,26 @@ export async function renderTable(tableHeaders, tableData, borderless) {
42
44
  export async function renderList(items) {
43
45
  await renderTable([''], items, true);
44
46
  }
47
+ export async function renderInteractive(component, options = {
48
+ fullScreen: false,
49
+ }) {
50
+ if (options.fullScreen) {
51
+ // Enter alternative buffer
52
+ process.stdout.write('\x1b[?1049h');
53
+ let instance;
54
+ try {
55
+ instance = render(_jsx(FullScreen, { children: component }), {
56
+ patchConsole: true,
57
+ });
58
+ await instance.waitUntilExit();
59
+ }
60
+ finally {
61
+ // Exit alternative buffer
62
+ process.stdout.write('\x1b[?1049l');
63
+ }
64
+ }
65
+ else {
66
+ const instance = render(component);
67
+ await instance.waitUntilExit();
68
+ }
69
+ }
package/ui/styles.d.ts CHANGED
@@ -14,5 +14,8 @@ export declare const INK_COLORS: {
14
14
  SUCCESS_GREEN: string;
15
15
  INFO_BLUE: string;
16
16
  WARNING_YELLOW: string;
17
+ HUBSPOT_ORANGE: string;
18
+ HUBSPOT_TEAL: string;
17
19
  WHITE: string;
20
+ GRAY: string;
18
21
  };
package/ui/styles.js CHANGED
@@ -14,5 +14,8 @@ export const INK_COLORS = {
14
14
  SUCCESS_GREEN: '#4deb7a',
15
15
  INFO_BLUE: '#4dcbeb',
16
16
  WARNING_YELLOW: '#EEB117',
17
+ HUBSPOT_ORANGE: '#FF7A59',
18
+ HUBSPOT_TEAL: '#00BDA5',
17
19
  WHITE: 'white',
20
+ GRAY: '#99ACC2',
18
21
  };