@hs-x/cli 0.3.7 → 0.4.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/README.md +120 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +38 -10
- package/dist/cli/index.js.map +1 -1
- package/dist/command-catalog.d.ts +2 -2
- package/dist/command-catalog.d.ts.map +1 -1
- package/dist/command-catalog.js +1 -0
- package/dist/command-catalog.js.map +1 -1
- package/dist/commands/completion.d.ts.map +1 -1
- package/dist/commands/completion.js +268 -16
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/connect.d.ts.map +1 -1
- package/dist/commands/connect.js +177 -20
- package/dist/commands/connect.js.map +1 -1
- package/dist/commands/control-plane-read.d.ts +28 -0
- package/dist/commands/control-plane-read.d.ts.map +1 -1
- package/dist/commands/control-plane-read.js +134 -28
- package/dist/commands/control-plane-read.js.map +1 -1
- package/dist/commands/deploy.d.ts +5 -0
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +605 -102
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.d.ts +19 -1
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +1335 -83
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +27 -10
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/help-command.d.ts.map +1 -1
- package/dist/commands/help-command.js +145 -35
- package/dist/commands/help-command.js.map +1 -1
- package/dist/commands/project.d.ts +107 -0
- package/dist/commands/project.d.ts.map +1 -0
- package/dist/commands/project.js +586 -0
- package/dist/commands/project.js.map +1 -0
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +15 -5
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/validate.d.ts +19 -0
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +26 -7
- package/dist/commands/validate.js.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/dev/account-selection.d.ts +16 -0
- package/dist/dev/account-selection.d.ts.map +1 -0
- package/dist/dev/account-selection.js +22 -0
- package/dist/dev/account-selection.js.map +1 -0
- package/dist/dev/browser-log-bridge.d.ts +32 -0
- package/dist/dev/browser-log-bridge.d.ts.map +1 -0
- package/dist/dev/browser-log-bridge.js +156 -0
- package/dist/dev/browser-log-bridge.js.map +1 -0
- package/dist/dev/compat-shim.d.ts +3 -3
- package/dist/dev/compat-shim.d.ts.map +1 -1
- package/dist/dev/compat-shim.js +7 -6
- package/dist/dev/compat-shim.js.map +1 -1
- package/dist/dev/component-selection.d.ts +25 -0
- package/dist/dev/component-selection.d.ts.map +1 -0
- package/dist/dev/component-selection.js +79 -0
- package/dist/dev/component-selection.js.map +1 -0
- package/dist/dev/console-capture.d.ts +18 -0
- package/dist/dev/console-capture.d.ts.map +1 -0
- package/dist/dev/console-capture.js +57 -0
- package/dist/dev/console-capture.js.map +1 -0
- package/dist/dev/event-bus.d.ts +1 -1
- package/dist/dev/event-bus.js +1 -1
- package/dist/dev/frontend-log-relay.d.ts +27 -0
- package/dist/dev/frontend-log-relay.d.ts.map +1 -0
- package/dist/dev/frontend-log-relay.js +102 -0
- package/dist/dev/frontend-log-relay.js.map +1 -0
- package/dist/dev/keyboard.d.ts +1 -0
- package/dist/dev/keyboard.d.ts.map +1 -1
- package/dist/dev/keyboard.js +9 -3
- package/dist/dev/keyboard.js.map +1 -1
- package/dist/dev/log-server.js +3 -0
- package/dist/dev/log-server.js.map +1 -1
- package/dist/dev/managed-session.d.ts +124 -0
- package/dist/dev/managed-session.d.ts.map +1 -0
- package/dist/dev/managed-session.js +597 -0
- package/dist/dev/managed-session.js.map +1 -0
- package/dist/dev/port-process.d.ts +21 -0
- package/dist/dev/port-process.d.ts.map +1 -0
- package/dist/dev/port-process.js +145 -0
- package/dist/dev/port-process.js.map +1 -0
- package/dist/dev/session-manager.d.ts +11 -1
- package/dist/dev/session-manager.d.ts.map +1 -1
- package/dist/dev/session-manager.js +62 -12
- package/dist/dev/session-manager.js.map +1 -1
- package/dist/dev/stream-event-format.d.ts +14 -0
- package/dist/dev/stream-event-format.d.ts.map +1 -0
- package/dist/dev/stream-event-format.js +262 -0
- package/dist/dev/stream-event-format.js.map +1 -0
- package/dist/dev/stream-filter.d.ts.map +1 -1
- package/dist/dev/stream-filter.js +16 -1
- package/dist/dev/stream-filter.js.map +1 -1
- package/dist/dev/stream-renderer.d.ts +4 -2
- package/dist/dev/stream-renderer.d.ts.map +1 -1
- package/dist/dev/stream-renderer.js +224 -84
- package/dist/dev/stream-renderer.js.map +1 -1
- package/dist/errors-registry.d.ts.map +1 -1
- package/dist/errors-registry.js +213 -0
- package/dist/errors-registry.js.map +1 -1
- package/dist/hubspot-app-logs.d.ts +38 -5
- package/dist/hubspot-app-logs.d.ts.map +1 -1
- package/dist/hubspot-app-logs.js +88 -17
- package/dist/hubspot-app-logs.js.map +1 -1
- package/dist/hubspot-auth.d.ts +19 -1
- package/dist/hubspot-auth.d.ts.map +1 -1
- package/dist/hubspot-auth.js +240 -85
- package/dist/hubspot-auth.js.map +1 -1
- package/dist/hubspot-developer-client.d.ts +87 -0
- package/dist/hubspot-developer-client.d.ts.map +1 -1
- package/dist/hubspot-developer-client.js +232 -1
- package/dist/hubspot-developer-client.js.map +1 -1
- package/dist/hubspot-project-archive.d.ts +21 -0
- package/dist/hubspot-project-archive.d.ts.map +1 -0
- package/dist/hubspot-project-archive.js +281 -0
- package/dist/hubspot-project-archive.js.map +1 -0
- package/dist/hubspot-project.d.ts +32 -0
- package/dist/hubspot-project.d.ts.map +1 -0
- package/dist/hubspot-project.js +269 -0
- package/dist/hubspot-project.js.map +1 -0
- package/dist/local-project-picker.js +1 -1
- package/dist/local-project-picker.js.map +1 -1
- package/dist/output-context.js +1 -1
- package/dist/output-context.js.map +1 -1
- package/dist/services/hubspot-dev-client.js +3 -0
- package/dist/services/hubspot-dev-client.js.map +1 -1
- package/package.json +14 -12
|
@@ -78,7 +78,7 @@ export function completionCommand({ argv, json, }) {
|
|
|
78
78
|
}
|
|
79
79
|
return { exitCode: 0 };
|
|
80
80
|
}
|
|
81
|
-
const
|
|
81
|
+
const GLOBAL_COMPLETION_FLAGS = [
|
|
82
82
|
'--help',
|
|
83
83
|
'--help-all',
|
|
84
84
|
'--json',
|
|
@@ -90,25 +90,201 @@ const COMPLETION_FLAGS = [
|
|
|
90
90
|
'--no-color',
|
|
91
91
|
'--no-telemetry',
|
|
92
92
|
'--no-update-check',
|
|
93
|
+
'--format-output-as-json',
|
|
94
|
+
'--json-schema',
|
|
95
|
+
'--version',
|
|
96
|
+
];
|
|
97
|
+
// Preserve useful coverage for commands that do not yet have a dedicated path
|
|
98
|
+
// spec. Context-specific dev/deploy metadata below is the source of truth for
|
|
99
|
+
// their newer subcommands and flags.
|
|
100
|
+
const SHARED_COMMAND_FLAGS = [
|
|
93
101
|
'--project',
|
|
102
|
+
'--account',
|
|
103
|
+
'--config',
|
|
104
|
+
'--use-env',
|
|
94
105
|
'--account-id',
|
|
95
106
|
'--project-id',
|
|
96
107
|
'--env',
|
|
97
108
|
'--yes',
|
|
98
109
|
'--force',
|
|
99
|
-
'--
|
|
110
|
+
'--detach',
|
|
111
|
+
'--session',
|
|
112
|
+
'--follow',
|
|
113
|
+
'--cursor',
|
|
114
|
+
'--lane',
|
|
115
|
+
'--level',
|
|
116
|
+
'--search',
|
|
117
|
+
'--since',
|
|
118
|
+
'--limit',
|
|
119
|
+
'--profile',
|
|
120
|
+
'--function',
|
|
121
|
+
'--latest',
|
|
122
|
+
'--compact',
|
|
123
|
+
];
|
|
124
|
+
const DEV_SUBCOMMANDS = [
|
|
125
|
+
'start',
|
|
126
|
+
'logs',
|
|
127
|
+
'status',
|
|
128
|
+
'restart',
|
|
129
|
+
'stop',
|
|
130
|
+
'invoke',
|
|
131
|
+
'cleanup',
|
|
132
|
+
];
|
|
133
|
+
const PUBLIC_DEV_FLAGS = [
|
|
134
|
+
'--port',
|
|
135
|
+
'--target-origin',
|
|
136
|
+
'--project-id',
|
|
137
|
+
'--account-id',
|
|
138
|
+
'--ttl-seconds',
|
|
139
|
+
'--project-account',
|
|
140
|
+
'--testing-account',
|
|
141
|
+
'--component',
|
|
142
|
+
'--pick',
|
|
143
|
+
'--only',
|
|
144
|
+
'--hsx-log-port',
|
|
145
|
+
'--no-hubspot',
|
|
146
|
+
'--no-ui-extensions',
|
|
147
|
+
'--profile',
|
|
148
|
+
'--account',
|
|
149
|
+
'--portal',
|
|
150
|
+
];
|
|
151
|
+
const PUBLIC_DIRECT_DEPLOY_FLAGS = [
|
|
152
|
+
'--account',
|
|
153
|
+
'--config',
|
|
154
|
+
'--use-env',
|
|
155
|
+
'--plan',
|
|
156
|
+
'--dry-run',
|
|
157
|
+
'--yes',
|
|
158
|
+
'--hubspot-upload-only',
|
|
159
|
+
'--skip-deploy',
|
|
160
|
+
'--pak',
|
|
161
|
+
'--message',
|
|
162
|
+
'--force',
|
|
163
|
+
];
|
|
164
|
+
const PUBLIC_HSX_DEPLOY_FLAGS = [
|
|
165
|
+
'--account-id',
|
|
166
|
+
'--project-id',
|
|
167
|
+
'--env',
|
|
168
|
+
'--environment',
|
|
169
|
+
'--hubspot-upload',
|
|
170
|
+
'--cloudflare-deploy',
|
|
171
|
+
'--build-only',
|
|
172
|
+
'--portal-schema-live',
|
|
173
|
+
'--apply-schema',
|
|
174
|
+
'--record-local',
|
|
175
|
+
'--promote-when-healthy',
|
|
176
|
+
'--no-record',
|
|
177
|
+
'--heartbeat',
|
|
178
|
+
'--no-heartbeat',
|
|
179
|
+
'--hubspot-only',
|
|
180
|
+
'--cloudflare-dry-run',
|
|
181
|
+
'--no-manage-schema',
|
|
182
|
+
'--user-id',
|
|
183
|
+
];
|
|
184
|
+
function flags(...groups) {
|
|
185
|
+
return [...new Set(groups.flat())];
|
|
186
|
+
}
|
|
187
|
+
// One path-aware catalog drives bash, zsh, and fish. Alias paths share the same
|
|
188
|
+
// spec instead of copying independent command/flag lists.
|
|
189
|
+
const COMPLETION_SPECS = [
|
|
190
|
+
{
|
|
191
|
+
paths: [''],
|
|
192
|
+
subcommands: ROOT_COMMANDS,
|
|
193
|
+
flags: flags(GLOBAL_COMPLETION_FLAGS, SHARED_COMMAND_FLAGS),
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
paths: ['project'],
|
|
197
|
+
subcommands: ['dev', 'info', 'list-builds', 'logs', 'validate'],
|
|
198
|
+
flags: flags(GLOBAL_COMPLETION_FLAGS, ['--account', '--profile', '--format-output-as-json']),
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
paths: ['dev', 'project dev'],
|
|
202
|
+
subcommands: DEV_SUBCOMMANDS,
|
|
203
|
+
flags: flags(GLOBAL_COMPLETION_FLAGS, PUBLIC_DEV_FLAGS, ['--detach', '--yes']),
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
paths: ['dev start', 'project dev start'],
|
|
207
|
+
subcommands: [],
|
|
208
|
+
flags: flags(GLOBAL_COMPLETION_FLAGS, PUBLIC_DEV_FLAGS, ['--wait-seconds', '--yes']),
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
paths: ['dev logs', 'project dev logs'],
|
|
212
|
+
subcommands: [],
|
|
213
|
+
flags: flags(GLOBAL_COMPLETION_FLAGS, [
|
|
214
|
+
'--session',
|
|
215
|
+
'--follow',
|
|
216
|
+
'--cursor',
|
|
217
|
+
'--lane',
|
|
218
|
+
'--level',
|
|
219
|
+
'--search',
|
|
220
|
+
'--since',
|
|
221
|
+
'--limit',
|
|
222
|
+
]),
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
paths: ['dev status', 'project dev status'],
|
|
226
|
+
subcommands: [],
|
|
227
|
+
flags: flags(GLOBAL_COMPLETION_FLAGS, [
|
|
228
|
+
'--session',
|
|
229
|
+
'--control-plane-url',
|
|
230
|
+
'--account-id',
|
|
231
|
+
'--user-id',
|
|
232
|
+
]),
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
paths: ['dev restart', 'project dev restart'],
|
|
236
|
+
subcommands: [],
|
|
237
|
+
flags: flags(GLOBAL_COMPLETION_FLAGS, ['--session', '--wait-seconds', '--yes', '--force']),
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
paths: ['dev stop', 'project dev stop'],
|
|
241
|
+
subcommands: [],
|
|
242
|
+
flags: flags(GLOBAL_COMPLETION_FLAGS, ['--session', '--yes', '--force']),
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
paths: ['dev invoke', 'project dev invoke'],
|
|
246
|
+
subcommands: [],
|
|
247
|
+
flags: flags(GLOBAL_COMPLETION_FLAGS, [
|
|
248
|
+
'--input',
|
|
249
|
+
'--object',
|
|
250
|
+
'--install',
|
|
251
|
+
'--last',
|
|
252
|
+
'--remote',
|
|
253
|
+
'--url',
|
|
254
|
+
]),
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
paths: ['dev cleanup', 'project dev cleanup'],
|
|
258
|
+
subcommands: [],
|
|
259
|
+
flags: flags(GLOBAL_COMPLETION_FLAGS, [
|
|
260
|
+
'--control-plane-url',
|
|
261
|
+
'--account-id',
|
|
262
|
+
'--session-id',
|
|
263
|
+
'--yes',
|
|
264
|
+
]),
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
paths: ['deploy'],
|
|
268
|
+
subcommands: ['promote'],
|
|
269
|
+
flags: flags(GLOBAL_COMPLETION_FLAGS, PUBLIC_DIRECT_DEPLOY_FLAGS, PUBLIC_HSX_DEPLOY_FLAGS),
|
|
270
|
+
},
|
|
100
271
|
];
|
|
101
272
|
function renderCompletion(shell) {
|
|
102
|
-
const commands = ROOT_COMMANDS.join(' ');
|
|
103
|
-
const flags = COMPLETION_FLAGS.join(' ');
|
|
104
273
|
switch (shell) {
|
|
105
274
|
case 'bash':
|
|
106
|
-
return
|
|
275
|
+
return `${renderBashContextFunction()}
|
|
276
|
+
_hs_x_completion() {
|
|
107
277
|
local cur="\${COMP_WORDS[COMP_CWORD]}"
|
|
278
|
+
local context="$(_hs_x_context)"
|
|
279
|
+
local commands flags
|
|
280
|
+
case "$context" in
|
|
281
|
+
${renderBashSpecCases()}
|
|
282
|
+
*) commands=""; flags="${GLOBAL_COMPLETION_FLAGS.join(' ')}" ;;
|
|
283
|
+
esac
|
|
108
284
|
if [[ "\${cur}" == -* ]]; then
|
|
109
|
-
COMPREPLY=( $(compgen -W "
|
|
285
|
+
COMPREPLY=( $(compgen -W "\${flags}" -- "\${cur}") )
|
|
110
286
|
else
|
|
111
|
-
COMPREPLY=( $(compgen -W "
|
|
287
|
+
COMPREPLY=( $(compgen -W "\${commands}" -- "\${cur}") )
|
|
112
288
|
fi
|
|
113
289
|
}
|
|
114
290
|
complete -F _hs_x_completion hs-x hsx
|
|
@@ -116,27 +292,103 @@ complete -F _hs_x_completion hs-x hsx
|
|
|
116
292
|
case 'zsh':
|
|
117
293
|
return `#compdef hs-x hsx
|
|
118
294
|
_hs_x() {
|
|
295
|
+
local context="" token
|
|
296
|
+
local -i index
|
|
119
297
|
local -a commands flags
|
|
120
|
-
|
|
121
|
-
|
|
298
|
+
for ((index = 2; index < CURRENT; index++)); do
|
|
299
|
+
token="$words[index]"
|
|
300
|
+
[[ "$token" == -* ]] && continue
|
|
301
|
+
case "$context:$token" in
|
|
302
|
+
${renderContextTransitions(' ')}
|
|
303
|
+
esac
|
|
304
|
+
done
|
|
305
|
+
case "$context" in
|
|
306
|
+
${renderZshSpecCases()}
|
|
307
|
+
*) commands=(); flags=(${GLOBAL_COMPLETION_FLAGS.join(' ')}) ;;
|
|
308
|
+
esac
|
|
122
309
|
if [[ "$words[CURRENT]" == -* ]]; then
|
|
123
310
|
_describe 'flags' flags
|
|
124
|
-
|
|
311
|
+
elif (( \${#commands[@]} > 0 )); then
|
|
125
312
|
_describe 'commands' commands
|
|
126
313
|
fi
|
|
127
314
|
}
|
|
128
315
|
compdef _hs_x hs-x hsx
|
|
129
316
|
`;
|
|
130
317
|
case 'fish':
|
|
131
|
-
return `${
|
|
132
|
-
|
|
133
|
-
.join('\n')}
|
|
134
|
-
${['hs-x', 'hsx']
|
|
135
|
-
.flatMap((binary) => COMPLETION_FLAGS.map((flag) => `complete -c ${binary} -f -l ${flag.slice(2)}`))
|
|
136
|
-
.join('\n')}
|
|
318
|
+
return `${renderFishContextFunction()}
|
|
319
|
+
${renderFishCompletions()}
|
|
137
320
|
`;
|
|
138
321
|
}
|
|
139
322
|
}
|
|
323
|
+
function renderBashContextFunction() {
|
|
324
|
+
return `_hs_x_context() {
|
|
325
|
+
local context="" token
|
|
326
|
+
local -i index
|
|
327
|
+
for ((index = 1; index < COMP_CWORD; index++)); do
|
|
328
|
+
token="\${COMP_WORDS[index]}"
|
|
329
|
+
[[ "$token" == -* ]] && continue
|
|
330
|
+
case "$context:$token" in
|
|
331
|
+
${renderContextTransitions(' ')}
|
|
332
|
+
esac
|
|
333
|
+
done
|
|
334
|
+
printf '%s' "$context"
|
|
335
|
+
}`;
|
|
336
|
+
}
|
|
337
|
+
function renderContextTransitions(indent) {
|
|
338
|
+
return completionTransitions()
|
|
339
|
+
.map(({ from, token, to }) => `${indent}"${from}:${token}") context="${to}" ;;`)
|
|
340
|
+
.join('\n');
|
|
341
|
+
}
|
|
342
|
+
function completionTransitions() {
|
|
343
|
+
const transitions = new Map();
|
|
344
|
+
for (const spec of COMPLETION_SPECS) {
|
|
345
|
+
for (const from of spec.paths) {
|
|
346
|
+
for (const token of spec.subcommands) {
|
|
347
|
+
const transition = { from, token, to: from ? `${from} ${token}` : token };
|
|
348
|
+
transitions.set(`${from}\0${token}`, transition);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
return [...transitions.values()];
|
|
353
|
+
}
|
|
354
|
+
function renderBashSpecCases() {
|
|
355
|
+
return COMPLETION_SPECS.map((spec) => ` ${spec.paths.map((path) => `"${path}"`).join('|')}) commands="${spec.subcommands.join(' ')}"; flags="${spec.flags.join(' ')}" ;;`).join('\n');
|
|
356
|
+
}
|
|
357
|
+
function renderZshSpecCases() {
|
|
358
|
+
return COMPLETION_SPECS.map((spec) => ` ${spec.paths.map((path) => `"${path}"`).join('|')}) commands=(${spec.subcommands.join(' ')}); flags=(${spec.flags.join(' ')}) ;;`).join('\n');
|
|
359
|
+
}
|
|
360
|
+
function renderFishContextFunction() {
|
|
361
|
+
return `function __hs_x_context
|
|
362
|
+
set -l context ''
|
|
363
|
+
set -l tokens (commandline -opc)
|
|
364
|
+
for token in $tokens[2..-1]
|
|
365
|
+
if string match -q -- '-*' $token
|
|
366
|
+
continue
|
|
367
|
+
end
|
|
368
|
+
switch "$context:$token"
|
|
369
|
+
${completionTransitions()
|
|
370
|
+
.map(({ from, token, to }) => ` case '${from}:${token}'\n set context '${to}'`)
|
|
371
|
+
.join('\n')}
|
|
372
|
+
end
|
|
373
|
+
end
|
|
374
|
+
if test -z "$context"
|
|
375
|
+
printf '%s' '__root__'
|
|
376
|
+
else
|
|
377
|
+
printf '%s' "$context"
|
|
378
|
+
end
|
|
379
|
+
end`;
|
|
380
|
+
}
|
|
381
|
+
function renderFishCompletions() {
|
|
382
|
+
return ['hs-x', 'hsx']
|
|
383
|
+
.flatMap((binary) => COMPLETION_SPECS.flatMap((spec) => spec.paths.flatMap((path) => {
|
|
384
|
+
const condition = `test (__hs_x_context) = "${path || '__root__'}"`;
|
|
385
|
+
return [
|
|
386
|
+
...spec.subcommands.map((subcommand) => `complete -c ${binary} -f -n '${condition}' -a ${subcommand}`),
|
|
387
|
+
...spec.flags.map((flag) => `complete -c ${binary} -f -n '${condition}' -l ${flag.slice(2)}`),
|
|
388
|
+
];
|
|
389
|
+
})))
|
|
390
|
+
.join('\n');
|
|
391
|
+
}
|
|
140
392
|
export function completionHelpText() {
|
|
141
393
|
return `hs-x completion <shell>
|
|
142
394
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completion.js","sourceRoot":"","sources":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AAG,4BAA4B,IAAI,IAAI,UAAU,GAAG,CAAC;QACpE,OAAO;YACL,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CACrB,CAAC,UAAU,EAAE,EAAE,CAAC,eAAe,MAAM,WAAW,SAAS,QAAQ,UAAU,EAAE,CAC9E;YACD,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CACf,CAAC,IAAI,EAAE,EAAE,CAAC,eAAe,MAAM,WAAW,SAAS,QAAQ,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAC3E;SACF,CAAC;IACJ,CAAC,CAAC,CACH,CACF;SACA,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,OAAO;;;;;;;;CAQR,CAAC;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../src/commands/connect.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../src/commands/connect.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAwI9C,wBAAsB,cAAc,CAAC,EACnC,IAAI,EACJ,GAAG,EACH,IAAI,GACL,EAAE;IACD,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB,GAAG,OAAO,CAAC,SAAS,CAAC,CAoBrB;AAs0DD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4DyD,CAAC;AAIjF,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAWhC,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/commands/connect.js
CHANGED
|
@@ -22,6 +22,87 @@ async function hostedHttp(input) {
|
|
|
22
22
|
function isRecord(value) {
|
|
23
23
|
return typeof value === 'object' && value !== null;
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* A non-2xx from a hosted control-plane credential route, with the status and
|
|
27
|
+
* the CP's `{ error, message }` body preserved so callers can branch on
|
|
28
|
+
* authorization failures instead of collapsing everything into one retry
|
|
29
|
+
* message.
|
|
30
|
+
*/
|
|
31
|
+
class ControlPlaneRequestError extends Error {
|
|
32
|
+
name = 'ControlPlaneRequestError';
|
|
33
|
+
status;
|
|
34
|
+
errorCode;
|
|
35
|
+
constructor(status, errorCode, message) {
|
|
36
|
+
super(message);
|
|
37
|
+
this.status = status;
|
|
38
|
+
this.errorCode = errorCode;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async function toControlPlaneRequestError(response, fallback) {
|
|
42
|
+
const body = await response.json().catch(() => undefined);
|
|
43
|
+
const errorCode = isRecord(body) && typeof body.error === 'string' ? body.error : undefined;
|
|
44
|
+
const message = isRecord(body) && typeof body.message === 'string' ? body.message : fallback;
|
|
45
|
+
return new ControlPlaneRequestError(response.status, errorCode, message);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Credential routes (`/v1/accounts/:id/{hubspot,cloudflare}/…`) are admin-class
|
|
49
|
+
* under the control plane's PAT policy, while ordinary reads only need `read`.
|
|
50
|
+
* A deploy/read-scope token (the dashboard's create form defaults to deploy)
|
|
51
|
+
* therefore sails through every preliminary check and 403s only here — an
|
|
52
|
+
* unfixable-by-retry failure that must be reported as a scope problem, not a
|
|
53
|
+
* generic exchange error.
|
|
54
|
+
*/
|
|
55
|
+
function credentialAuthorizationDenied(input) {
|
|
56
|
+
if (input.error.status === 401) {
|
|
57
|
+
return inputValidationError({
|
|
58
|
+
argv: input.argv,
|
|
59
|
+
command: input.command,
|
|
60
|
+
json: input.json,
|
|
61
|
+
code: 'HSX_E_API_UNAUTHORIZED',
|
|
62
|
+
message: 'The control plane rejected the CLI credential.',
|
|
63
|
+
hint: 'Run `hs-x login` to refresh your CLI session, then retry.',
|
|
64
|
+
detail: input.error.message,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return inputValidationError({
|
|
68
|
+
argv: input.argv,
|
|
69
|
+
command: input.command,
|
|
70
|
+
json: input.json,
|
|
71
|
+
code: 'HSX_E_CREDENTIAL_SCOPE',
|
|
72
|
+
message: 'This CLI credential is not allowed to manage account credentials (admin scope required).',
|
|
73
|
+
hint: 'Run `hs-x login` — owners and admins get a full-access CLI session. If you logged in with a pasted API token, it needs admin scope (dashboard → API tokens); deploy and read tokens cannot connect credentials. Account members need an owner/admin to connect.',
|
|
74
|
+
detail: input.error.message,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function isCredentialAuthFailure(error) {
|
|
78
|
+
return (error instanceof ControlPlaneRequestError && (error.status === 401 || error.status === 403));
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Probe whether the current CLI credential may manage credentials on
|
|
82
|
+
* `accountId` BEFORE any browser consent or credential prompting. Uses the
|
|
83
|
+
* credential-connection read (same admin PAT class as the connect/complete
|
|
84
|
+
* mutations); 404 just means nothing is connected yet, so only 401/403 count
|
|
85
|
+
* as a refusal. Network errors are swallowed — the real call will surface
|
|
86
|
+
* them with full context.
|
|
87
|
+
*/
|
|
88
|
+
async function probeCredentialAuthorization(input) {
|
|
89
|
+
let response;
|
|
90
|
+
try {
|
|
91
|
+
response = await hostedHttp({
|
|
92
|
+
url: new URL(`/v1/accounts/${encodeURIComponent(input.accountId)}/${input.surface}`, input.controlPlaneUrl),
|
|
93
|
+
headers: {
|
|
94
|
+
accept: 'application/json',
|
|
95
|
+
...(await controlPlaneAuthHeaders(input.userId)),
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
if (response.status !== 401 && response.status !== 403)
|
|
103
|
+
return undefined;
|
|
104
|
+
return await toControlPlaneRequestError(response, `Credential authorization probe returned HTTP ${response.status}.`);
|
|
105
|
+
}
|
|
25
106
|
export async function connectCommand({ argv, cwd, json, }) {
|
|
26
107
|
// Only a non-flag token is a subcommand — bare `connect --account-id x`
|
|
27
108
|
// routes to the wizard with the flags passed through, not the help fallback.
|
|
@@ -133,6 +214,33 @@ async function connectHubspotCommand({ argv, cwd, json, }) {
|
|
|
133
214
|
reporter.info(`Binding into HS-X account: ${active.displayName} (${active.id})`);
|
|
134
215
|
}
|
|
135
216
|
}
|
|
217
|
+
// Linked connects mutate an admin-class credential route. Fail here — before
|
|
218
|
+
// the PAK browser flow and prompts — when the CLI credential can't manage
|
|
219
|
+
// credentials at all (e.g. a deploy-scope API token), instead of letting the
|
|
220
|
+
// user generate and paste a PAK only to be refused at the connect call.
|
|
221
|
+
if (linked && !localControlPlane && !noControlPlane) {
|
|
222
|
+
const { activeSession } = await import('../account-store.js');
|
|
223
|
+
const store = await loadStore();
|
|
224
|
+
const probeAccountId = resolveFlag(argv, '--account-id') ??
|
|
225
|
+
activeSession(store)?.accountId?.trim() ??
|
|
226
|
+
store.defaultAccountId?.trim();
|
|
227
|
+
if (probeAccountId) {
|
|
228
|
+
const denied = await probeCredentialAuthorization({
|
|
229
|
+
controlPlaneUrl: resolveControlPlaneUrl(argv),
|
|
230
|
+
accountId: probeAccountId,
|
|
231
|
+
surface: 'hubspot',
|
|
232
|
+
userId: resolveFlag(argv, '--user-id') ?? process.env.HSX_USER_ID ?? 'local-cli-user',
|
|
233
|
+
});
|
|
234
|
+
if (denied) {
|
|
235
|
+
return credentialAuthorizationDenied({
|
|
236
|
+
argv,
|
|
237
|
+
command: 'connect hubspot',
|
|
238
|
+
json,
|
|
239
|
+
error: denied,
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
136
244
|
let accountId = resolveFlag(argv, '--account-id');
|
|
137
245
|
let developerAccountId = resolveFlag(argv, '--developer-account-id');
|
|
138
246
|
let displayName = resolveFlag(argv, '--display-name');
|
|
@@ -434,12 +542,21 @@ async function connectHubspotCommand({ argv, cwd, json, }) {
|
|
|
434
542
|
throw error;
|
|
435
543
|
}
|
|
436
544
|
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
545
|
+
let connection;
|
|
546
|
+
try {
|
|
547
|
+
connection = await requestHostedControlPlaneHubSpotConnect({
|
|
548
|
+
accountId,
|
|
549
|
+
request,
|
|
550
|
+
controlPlaneUrl,
|
|
551
|
+
userId: resolveFlag(argv, '--user-id') ?? process.env.HSX_USER_ID ?? 'local-cli-user',
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
catch (error) {
|
|
555
|
+
if (isCredentialAuthFailure(error)) {
|
|
556
|
+
return credentialAuthorizationDenied({ argv, command: 'connect hubspot', json, error });
|
|
557
|
+
}
|
|
558
|
+
throw error;
|
|
559
|
+
}
|
|
443
560
|
const result = {
|
|
444
561
|
ok: true,
|
|
445
562
|
command: 'connect hubspot',
|
|
@@ -772,6 +889,20 @@ async function runCloudflareOAuthFlowBody(input) {
|
|
|
772
889
|
return { kind: 'success-brokered', connection };
|
|
773
890
|
}
|
|
774
891
|
catch (error) {
|
|
892
|
+
// An authorization refusal (deploy/read-scope PAT, expired session) can
|
|
893
|
+
// never be fixed by re-running the OAuth flow — telling the user to
|
|
894
|
+
// retry sends them through browser consent in a loop.
|
|
895
|
+
if (isCredentialAuthFailure(error)) {
|
|
896
|
+
return {
|
|
897
|
+
kind: 'error',
|
|
898
|
+
result: credentialAuthorizationDenied({
|
|
899
|
+
argv: input.argv,
|
|
900
|
+
command: 'connect cloudflare',
|
|
901
|
+
json: input.json,
|
|
902
|
+
error,
|
|
903
|
+
}),
|
|
904
|
+
};
|
|
905
|
+
}
|
|
775
906
|
const detail = error instanceof Error ? error.message : String(error);
|
|
776
907
|
return {
|
|
777
908
|
kind: 'error',
|
|
@@ -885,8 +1016,7 @@ async function postCloudflareOAuthComplete(input) {
|
|
|
885
1016
|
body: input.body,
|
|
886
1017
|
});
|
|
887
1018
|
if (!response.ok) {
|
|
888
|
-
|
|
889
|
-
throw new Error(`HTTP ${response.status}: ${text || response.statusText}`);
|
|
1019
|
+
throw await toControlPlaneRequestError(response, `Cloudflare OAuth completion failed with HTTP ${response.status}.`);
|
|
890
1020
|
}
|
|
891
1021
|
const raw = (await response.json());
|
|
892
1022
|
return Schema.decodeUnknownSync(schemas.CloudflareConnection)(raw);
|
|
@@ -1043,6 +1173,24 @@ async function connectCloudflareCommand({ argv, json, }) {
|
|
|
1043
1173
|
detail: `Account preflight returned HTTP ${status}.`,
|
|
1044
1174
|
});
|
|
1045
1175
|
}
|
|
1176
|
+
// Membership verified — now verify this credential may MANAGE credentials.
|
|
1177
|
+
// The account read above is read-class under PAT policy; the OAuth
|
|
1178
|
+
// completion is admin-class. Without this probe a deploy-scope token
|
|
1179
|
+
// passes preflight, burns a full browser consent, and only then 403s.
|
|
1180
|
+
const denied = await probeCredentialAuthorization({
|
|
1181
|
+
controlPlaneUrl,
|
|
1182
|
+
accountId,
|
|
1183
|
+
surface: 'cloudflare',
|
|
1184
|
+
userId,
|
|
1185
|
+
});
|
|
1186
|
+
if (denied) {
|
|
1187
|
+
return credentialAuthorizationDenied({
|
|
1188
|
+
argv,
|
|
1189
|
+
command: 'connect cloudflare',
|
|
1190
|
+
json,
|
|
1191
|
+
error: denied,
|
|
1192
|
+
});
|
|
1193
|
+
}
|
|
1046
1194
|
}
|
|
1047
1195
|
// OAuth (authorization code + PKCE) is the ONLY connection method — owner
|
|
1048
1196
|
// decision 2026-06-11. No API-token paste path in the CLI or the dashboard:
|
|
@@ -1181,16 +1329,25 @@ async function connectCloudflareCommand({ argv, json, }) {
|
|
|
1181
1329
|
};
|
|
1182
1330
|
const controlPlaneUrl = resolveFlag(argv, '--control-plane-url') ?? process.env.HSX_CONTROL_PLANE_URL;
|
|
1183
1331
|
const userId = resolveFlag(argv, '--user-id') ?? process.env.HSX_USER_ID ?? 'local-cli-user';
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
:
|
|
1332
|
+
let connection;
|
|
1333
|
+
try {
|
|
1334
|
+
connection = controlPlaneUrl
|
|
1335
|
+
? await requestHostedControlPlaneCloudflareConnect({
|
|
1336
|
+
accountId,
|
|
1337
|
+
request,
|
|
1338
|
+
controlPlaneUrl,
|
|
1339
|
+
userId,
|
|
1340
|
+
})
|
|
1341
|
+
: argv.includes('--local-control-plane')
|
|
1342
|
+
? await requestLocalControlPlaneCloudflareConnect({ accountId, request, userId })
|
|
1343
|
+
: undefined;
|
|
1344
|
+
}
|
|
1345
|
+
catch (error) {
|
|
1346
|
+
if (isCredentialAuthFailure(error)) {
|
|
1347
|
+
return credentialAuthorizationDenied({ argv, command: 'connect cloudflare', json, error });
|
|
1348
|
+
}
|
|
1349
|
+
throw error;
|
|
1350
|
+
}
|
|
1194
1351
|
if (!connection) {
|
|
1195
1352
|
const result = {
|
|
1196
1353
|
ok: true,
|
|
@@ -1277,7 +1434,7 @@ async function requestHostedControlPlaneHubSpotConnect({ accountId, request, con
|
|
|
1277
1434
|
});
|
|
1278
1435
|
const body = await response.json();
|
|
1279
1436
|
if (!response.ok) {
|
|
1280
|
-
throw new
|
|
1437
|
+
throw new ControlPlaneRequestError(response.status, isRecord(body) && typeof body.error === 'string' ? body.error : undefined, isRecord(body) && typeof body.message === 'string'
|
|
1281
1438
|
? body.message
|
|
1282
1439
|
: `Control-plane HubSpot connect failed with status ${response.status}`);
|
|
1283
1440
|
}
|
|
@@ -1313,7 +1470,7 @@ async function requestHostedControlPlaneCloudflareConnect({ accountId, request,
|
|
|
1313
1470
|
});
|
|
1314
1471
|
const body = await response.json();
|
|
1315
1472
|
if (!response.ok) {
|
|
1316
|
-
throw new
|
|
1473
|
+
throw new ControlPlaneRequestError(response.status, isRecord(body) && typeof body.error === 'string' ? body.error : undefined, isRecord(body) && typeof body.message === 'string'
|
|
1317
1474
|
? body.message
|
|
1318
1475
|
: `Control-plane Cloudflare connect failed with status ${response.status}`);
|
|
1319
1476
|
}
|