@hs-x/cli 0.1.0 → 0.1.2
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 +59 -33
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +152 -334
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/kit.d.ts +36 -0
- package/dist/cli/kit.d.ts.map +1 -0
- package/dist/cli/kit.js +64 -0
- package/dist/cli/kit.js.map +1 -0
- package/dist/cli-error.d.ts +19 -1
- package/dist/cli-error.d.ts.map +1 -1
- package/dist/cli-error.js +19 -4
- package/dist/cli-error.js.map +1 -1
- package/dist/commands/account.d.ts +55 -6
- package/dist/commands/account.d.ts.map +1 -1
- package/dist/commands/account.js +254 -252
- package/dist/commands/account.js.map +1 -1
- package/dist/commands/api.d.ts +16 -0
- package/dist/commands/api.d.ts.map +1 -1
- package/dist/commands/api.js +173 -0
- package/dist/commands/api.js.map +1 -1
- package/dist/commands/completion.d.ts +6 -0
- package/dist/commands/completion.d.ts.map +1 -1
- package/dist/commands/completion.js +34 -0
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/connect.d.ts +32 -0
- package/dist/commands/connect.d.ts.map +1 -1
- package/dist/commands/connect.js +126 -1
- package/dist/commands/connect.js.map +1 -1
- package/dist/commands/control-plane-read.d.ts +60 -17
- package/dist/commands/control-plane-read.d.ts.map +1 -1
- package/dist/commands/control-plane-read.js +269 -231
- package/dist/commands/control-plane-read.js.map +1 -1
- package/dist/commands/deploy-promote.d.ts +14 -0
- package/dist/commands/deploy-promote.d.ts.map +1 -1
- package/dist/commands/deploy-promote.js +128 -0
- package/dist/commands/deploy-promote.js.map +1 -1
- package/dist/commands/deploy.d.ts +57 -0
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +154 -1
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.d.ts +25 -0
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +108 -0
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/doctor.d.ts +7 -7
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +144 -143
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/flags.d.ts +35 -0
- package/dist/commands/flags.d.ts.map +1 -1
- package/dist/commands/flags.js +229 -0
- package/dist/commands/flags.js.map +1 -1
- package/dist/commands/history.d.ts +8 -5
- package/dist/commands/history.d.ts.map +1 -1
- package/dist/commands/history.js +46 -40
- package/dist/commands/history.js.map +1 -1
- package/dist/commands/init.d.ts +30 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +89 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/link.d.ts +15 -0
- package/dist/commands/link.d.ts.map +1 -1
- package/dist/commands/link.js +284 -0
- package/dist/commands/link.js.map +1 -1
- package/dist/commands/login.d.ts +17 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +79 -21
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/migrate.d.ts +32 -0
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +255 -0
- package/dist/commands/migrate.js.map +1 -1
- package/dist/commands/rollback.d.ts +22 -0
- package/dist/commands/rollback.d.ts.map +1 -1
- package/dist/commands/rollback.js +271 -0
- package/dist/commands/rollback.js.map +1 -1
- package/dist/commands/secrets.d.ts +35 -5
- package/dist/commands/secrets.d.ts.map +1 -1
- package/dist/commands/secrets.js +94 -196
- package/dist/commands/secrets.js.map +1 -1
- package/dist/commands/status.d.ts +8 -5
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +162 -121
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/unlink.d.ts +11 -0
- package/dist/commands/unlink.d.ts.map +1 -1
- package/dist/commands/unlink.js +75 -0
- package/dist/commands/unlink.js.map +1 -1
- package/dist/commands/update.d.ts +8 -4
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +83 -35
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/validate.d.ts +12 -6
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +50 -23
- package/dist/commands/validate.js.map +1 -1
- package/dist/config.d.ts +8 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/init/templates.js +1 -1
- package/dist/init/templates.js.map +1 -1
- package/dist/services/cloudflare-kv.d.ts +2 -2
- package/dist/services/cloudflare-kv.d.ts.map +1 -1
- package/dist/services/cloudflare-kv.js +10 -6
- package/dist/services/cloudflare-kv.js.map +1 -1
- package/dist/services/command-history.d.ts +2 -0
- package/dist/services/command-history.d.ts.map +1 -1
- package/dist/services/command-history.js +1 -1
- package/dist/services/command-history.js.map +1 -1
- package/dist/services/config.d.ts +24 -0
- package/dist/services/config.d.ts.map +1 -0
- package/dist/services/config.js +41 -0
- package/dist/services/config.js.map +1 -0
- package/dist/services/cwd.d.ts +12 -0
- package/dist/services/cwd.d.ts.map +1 -0
- package/dist/services/cwd.js +10 -0
- package/dist/services/cwd.js.map +1 -0
- package/dist/services/hubspot-dev-client.d.ts +38 -0
- package/dist/services/hubspot-dev-client.d.ts.map +1 -0
- package/dist/services/hubspot-dev-client.js +256 -0
- package/dist/services/hubspot-dev-client.js.map +1 -0
- package/dist/services/live.d.ts +7 -1
- package/dist/services/live.d.ts.map +1 -1
- package/dist/services/live.js +20 -8
- package/dist/services/live.js.map +1 -1
- package/dist/services/reporter.d.ts +14 -0
- package/dist/services/reporter.d.ts.map +1 -1
- package/dist/services/reporter.js +20 -0
- package/dist/services/reporter.js.map +1 -1
- package/dist/services/telemetry.d.ts +43 -0
- package/dist/services/telemetry.d.ts.map +1 -0
- package/dist/services/telemetry.js +93 -0
- package/dist/services/telemetry.js.map +1 -0
- package/dist/services/tenant-state.d.ts +85 -0
- package/dist/services/tenant-state.d.ts.map +1 -0
- package/dist/services/tenant-state.js +98 -0
- package/dist/services/tenant-state.js.map +1 -0
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
>
|
|
5
5
|
> This file is the CLI *contract* — what `hs-x` will look like at completion. Many sections below describe commands, flags, or packages that are **not yet implemented**. For the actually-shipped CLI surface, run `hs-x --help` or read `packages/cli/src/index.ts` (the dispatch switch is the source of truth).
|
|
6
6
|
>
|
|
7
|
-
> Sections that drift from current implementation are marked inline with `[NOT YET IMPLEMENTED]` or `[PARTIAL]`. As of 2026-
|
|
7
|
+
> Sections that drift from current implementation are marked inline with `[NOT YET IMPLEMENTED]` or `[PARTIAL]`. As of v1 (2026-06), shipped top-level commands are: `init` (alias `create`), `check`, `validate`, `deploy`, `connect`, `secrets`, `link`, `unlink`, `login`, `whoami`, `logout`, `completion`, `api`, `account`/`accounts`, `audit`, `drift`, `checkpoint`/`logs`, `routing`/`route`/`routes`, `promote`, `rollback`, `dev`, `migrate`, `flags`, `doctor`, `status`, `history`, `update`/`upgrade`. The planned monorepo package layout below does **not** match the actual `packages/` tree — see the workspace for the real list.
|
|
8
8
|
|
|
9
9
|
*Working draft. This is the CLI contract for `hs-x` after the SDK/interface review pass. It assumes a monorepo implementation and keeps the CLI as orchestration over reusable packages. The CLI is the human surface, the CI surface, and the coding-agent surface; every command that matters must have stable JSON output and a matching MCP tool.*
|
|
10
10
|
|
|
@@ -15,7 +15,7 @@ This update folds in the root docs, `sdk/README.md`, and the current review find
|
|
|
15
15
|
- first-run setup needs a single `hs-x connect` golden path;
|
|
16
16
|
- portal-scoped dev routing requires an initial deployed runtime, so `dev` cannot pretend it is purely local;
|
|
17
17
|
- the migration/card path should support Cloudflare-light or HubSpot-only first value where possible;
|
|
18
|
-
- deploys use
|
|
18
|
+
- deploys use attestation-gated promotion, compatibility classification, rollback, and promotion;
|
|
19
19
|
- metadata iteration needs an explicit command path (`dev upload` or `deploy --metadata-only`);
|
|
20
20
|
- dev overrides should be exact capability matches in v1, not wildcard by default;
|
|
21
21
|
- data-plane drift needs first-class commands (`doctor`, `drift`, `repair`);
|
|
@@ -35,7 +35,7 @@ This update folds in the root docs, `sdk/README.md`, and the current review find
|
|
|
35
35
|
|
|
36
36
|
## Monorepo package layout
|
|
37
37
|
|
|
38
|
-
> **[PLANNED — does not match current `packages/` tree]** The actual workspace uses a smaller set of packages (`checkpoint`, `codegen`, `control-plane`, `design`, `e2e`, `email`, `fixtures`, `hubspot-cli`, `hubspot-client`, `hubspot-mock`, `mcp`, `runtime`, `sdk`, `
|
|
38
|
+
> **[PLANNED — does not match current `packages/` tree]** The actual workspace uses a smaller set of packages (`checkpoint`, `codegen`, `control-plane`, `design`, `e2e`, `email`, `fixtures`, `hubspot-cli`, `hubspot-client`, `hubspot-mock`, `mcp`, `runtime`, `sdk`, `studio`, `types`, `validator`). The breakdown below reflects the target decomposition, not what exists today.
|
|
39
39
|
|
|
40
40
|
The CLI package owns command registration, option parsing, prompts, and rendering. It does not own the core logic.
|
|
41
41
|
|
|
@@ -324,20 +324,34 @@ The CLI keeps HubSpot developer-account credentials distinct:
|
|
|
324
324
|
|
|
325
325
|
For raw calls, `hs-x api hubspot <path>` accepts PAK-only, HAPIKEY-only, or both. When both are present, the request includes bearer auth and the `hapikey` query parameter.
|
|
326
326
|
|
|
327
|
-
##
|
|
327
|
+
## Install
|
|
328
328
|
|
|
329
|
-
|
|
329
|
+
```bash
|
|
330
|
+
npm i -g @hs-x/cli
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
This installs the `hs-x` command on your PATH. Both Node and Bun run it. You can also invoke it without a global install via `bunx @hs-x/cli <command>`.
|
|
330
334
|
|
|
331
|
-
|
|
335
|
+
## First-run golden path
|
|
336
|
+
|
|
337
|
+
This is the unlinked, direct-to-HubSpot path: scaffold a project, install its deps, point it at your HubSpot dev app and a Cloudflare API token, run the local loop, then deploy to your own Cloudflare and HubSpot.
|
|
332
338
|
|
|
333
339
|
```bash
|
|
334
|
-
|
|
340
|
+
npm i -g @hs-x/cli
|
|
341
|
+
hs-x init deal-enricher
|
|
335
342
|
cd deal-enricher
|
|
336
|
-
|
|
337
|
-
|
|
343
|
+
bun install
|
|
344
|
+
# set HubSpot dev-app credentials + a Cloudflare API token
|
|
345
|
+
# (HSX_HUBSPOT_CLIENT_ID / HSX_HUBSPOT_CLIENT_SECRET, CLOUDFLARE_API_TOKEN, etc.)
|
|
346
|
+
hs-x dev # local development loop
|
|
347
|
+
hs-x deploy # deploy to your own Cloudflare + HubSpot
|
|
338
348
|
```
|
|
339
349
|
|
|
340
|
-
|
|
350
|
+
The CLI works direct-to-HubSpot without the HS-X platform. The control plane, dashboard, and billing are opt-in. Deployed apps run in *your* Cloudflare account.
|
|
351
|
+
|
|
352
|
+
### Platform-linked setup with `hs-x connect`
|
|
353
|
+
|
|
354
|
+
If you opt into the HS-X platform, `hs-x connect` is the broader golden path: it links the project to an HS-X account and walks HubSpot and Cloudflare setup. It is intentionally broad. It handles or guides:
|
|
341
355
|
|
|
342
356
|
- local HS-X auth;
|
|
343
357
|
- HS-X account selection;
|
|
@@ -387,31 +401,43 @@ hs-x accounts current [--json]
|
|
|
387
401
|
hs-x accounts switch <account>
|
|
388
402
|
```
|
|
389
403
|
|
|
390
|
-
### `hs-x
|
|
404
|
+
### `hs-x init`
|
|
391
405
|
|
|
392
|
-
|
|
406
|
+
Scaffolds a new HS-X project in a new directory named after the project. `hs-x create` is an accepted alias.
|
|
393
407
|
|
|
394
408
|
```text
|
|
395
|
-
hs-x
|
|
409
|
+
hs-x init [name] [--type workflow-action|sync-source|empty] [--app-name <name>] [--yes] [--no-install] [--force] [--cwd <dir>] [--quiet] [--json]
|
|
396
410
|
```
|
|
397
411
|
|
|
398
|
-
|
|
399
|
-
export interface CreateOptions {
|
|
400
|
-
name: string;
|
|
401
|
-
type: "workflow-action" | "sync-source" | "empty";
|
|
402
|
-
targetDir: string;
|
|
403
|
-
account?: string;
|
|
404
|
-
runtimePosture?: RuntimePosture;
|
|
405
|
-
addToWorkspace: boolean;
|
|
406
|
-
installDeps: boolean;
|
|
407
|
-
}
|
|
412
|
+
Flags:
|
|
408
413
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
414
|
+
- `--name <name>` — project directory and config name (a positional argument is also accepted).
|
|
415
|
+
- `--type <type>` — app type: `workflow-action` (default), `sync-source`, or `empty`. `--template <id>` is also accepted (`deals-tagger` is the workflow-action template).
|
|
416
|
+
- `--app-name <name>` — HubSpot app display name; defaults from the project name. `--display-name` is an accepted alias.
|
|
417
|
+
- `--yes`, `-y` — accept defaults: install dependencies and skip prompts.
|
|
418
|
+
- `--no-install` — skip the dependency install step.
|
|
419
|
+
- `--force` — overwrite an existing `hsx.config.ts` at the target.
|
|
420
|
+
- `--cwd <dir>` — run as if invoked from `<dir>`.
|
|
421
|
+
- `--quiet`, `-q` — suppress progress output.
|
|
422
|
+
- `--json` — emit a JSON result.
|
|
423
|
+
|
|
424
|
+
A scaffold writes `package.json`, `tsconfig.json`, `.gitignore`, `hsx.config.ts`, and one or more `src/workers/*.ts` files. The generated `package.json` depends on `@hs-x/sdk` and `@hs-x/runtime` from npm (no `workspace:*`, no per-project `hs-x` devDependency — the CLI is installed globally). The `.gitignore` ignores `.hs-x/*` except `.hs-x/alchemy.run.ts`, which is tracked as the leaveability artifact.
|
|
425
|
+
|
|
426
|
+
When invoked without `--type` in an interactive terminal, `init` prompts for the project name, the template, the HubSpot app name, and whether to install dependencies. In `--json` or non-interactive mode it falls back to defaults (project name `hsx-app`, the workflow-action template) and skips prompts.
|
|
427
|
+
|
|
428
|
+
The JSON result has the shape:
|
|
429
|
+
|
|
430
|
+
```json
|
|
431
|
+
{
|
|
432
|
+
"ok": true,
|
|
433
|
+
"command": "init",
|
|
434
|
+
"project": {
|
|
435
|
+
"name": "deal-enricher",
|
|
436
|
+
"appName": "Deal Enricher",
|
|
437
|
+
"root": "/abs/path/deal-enricher",
|
|
438
|
+
"template": "deals-tagger",
|
|
439
|
+
"installed": true
|
|
440
|
+
}
|
|
415
441
|
}
|
|
416
442
|
```
|
|
417
443
|
|
|
@@ -545,7 +571,7 @@ hs-x dev upload [--metadata-only] # [NOT YET IMPLEMEN
|
|
|
545
571
|
|
|
546
572
|
### `hs-x deploy`
|
|
547
573
|
|
|
548
|
-
Runs the
|
|
574
|
+
Runs the two-cloud deploy state machine. A deploy records a candidate, uploads Cloudflare and HubSpot assets through local execution, waits for runtime attestation to report healthy drift, then promotes the deploy in control-plane state. Full router-based revisioned routing is deferred.
|
|
549
575
|
|
|
550
576
|
```text
|
|
551
577
|
hs-x deploy [--project <name>] [--env staging|production] [--plan] [--diff] [--resume <deployId>] [--breaking] [--semantic-change] [--expected-rps <n>] [--metadata-only] [--hubspot-only] [--json]
|
|
@@ -591,7 +617,7 @@ export interface DeployResult {
|
|
|
591
617
|
}
|
|
592
618
|
```
|
|
593
619
|
|
|
594
|
-
|
|
620
|
+
Deploy state machine:
|
|
595
621
|
|
|
596
622
|
```text
|
|
597
623
|
plan_requested
|
|
@@ -625,7 +651,7 @@ Rules:
|
|
|
625
651
|
- `--hubspot-only` is allowed only for projects/capabilities with no Cloudflare runtime needs.
|
|
626
652
|
- `--plan` includes cost shape, Workers Paid requirements, streaming polling cost, custom-domain/permitted URL warnings, and drift status.
|
|
627
653
|
- If drift is detected, deploy offers `hs-x repair` first rather than silently deploying on top of drift.
|
|
628
|
-
- `--portal-schema-fixture <path>` runs the
|
|
654
|
+
- `--portal-schema-fixture <path>` runs the schema planner against deterministic observed schema JSON.
|
|
629
655
|
- `--portal-schema-live` reads the target portal schema through the HubSpot developer client; `--apply-schema` applies only the managed `WILL CREATE` / `WILL ALTER` actions from that plan.
|
|
630
656
|
|
|
631
657
|
### `hs-x promote`
|
|
@@ -997,5 +1023,5 @@ Exit codes:
|
|
|
997
1023
|
- `hs-x dev upload` vs `hs-x deploy --metadata-only`: should both exist or should one alias the other?
|
|
998
1024
|
- Exact first-run dev runtime: does `hs-x connect` always deploy a shell Worker, or only when a capability requires runtime hosting?
|
|
999
1025
|
- HubSpot-only migration: which legacy card shapes can truly deploy without Cloudflare?
|
|
1000
|
-
- Fresh-clone generated refs: should `hs-x
|
|
1026
|
+
- Fresh-clone generated refs: should `hs-x init` install a stub `@hs-x/refs` package or rely on generated `.hs-x/refs` after first `dev`/`deploy`?
|
|
1001
1027
|
- How much of `hs-x check` belongs in `validate` vs a marketplace-specific command?
|
package/dist/cli/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAiDA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AA6D9C,wBAAsB,MAAM,CAC1B,IAAI,GAAE,SAAS,MAAM,EAA0B,EAC/C,GAAG,SAAgB,GAClB,OAAO,CAAC,SAAS,CAAC,CAmFpB"}
|