@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
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as Options from '@effect/cli/Options';
|
|
2
|
+
import { Effect } from 'effect';
|
|
3
|
+
import { CliError } from '../cli-error.js';
|
|
4
|
+
import type { CliResult } from '../result.js';
|
|
5
|
+
import { Reporter, type ReporterFlags } from '../services/reporter.js';
|
|
6
|
+
/** Shared global options, declared once and spread into command option structs. */
|
|
7
|
+
export declare const jsonOption: Options.Options<boolean>;
|
|
8
|
+
export declare const verboseOption: Options.Options<boolean>;
|
|
9
|
+
export declare const quietOption: Options.Options<boolean>;
|
|
10
|
+
export declare const debugOption: Options.Options<boolean>;
|
|
11
|
+
export declare const cwdOption: Options.Options<import("effect/Option").Option<string>>;
|
|
12
|
+
export declare const controlPlaneUrlOption: Options.Options<import("effect/Option").Option<string>>;
|
|
13
|
+
export declare const accountIdOption: Options.Options<import("effect/Option").Option<string>>;
|
|
14
|
+
export declare const projectIdOption: Options.Options<import("effect/Option").Option<string>>;
|
|
15
|
+
export declare const userIdOption: Options.Options<import("effect/Option").Option<string>>;
|
|
16
|
+
export declare const deployIdOption: Options.Options<import("effect/Option").Option<string>>;
|
|
17
|
+
export declare const forceOption: Options.Options<boolean>;
|
|
18
|
+
export declare const yesOption: Options.Options<boolean>;
|
|
19
|
+
/**
|
|
20
|
+
* Quarantine seam for the heavy commands (deploy/dev/init/connect/login): run
|
|
21
|
+
* the existing imperative body (which renders its own success/handled-error
|
|
22
|
+
* output and returns a `CliResult`), and replicate the legacy direct
|
|
23
|
+
* dispatcher's catch exactly for a *thrown* error — `{ok:false,error}` on
|
|
24
|
+
* stdout in json mode, `Error: …` on stderr otherwise — then exit non-zero
|
|
25
|
+
* silently. This preserves byte-for-byte output through the Effect boundary.
|
|
26
|
+
*/
|
|
27
|
+
export declare function runQuarantined(json: boolean, body: () => Promise<CliResult>): Effect.Effect<void, CliError>;
|
|
28
|
+
/**
|
|
29
|
+
* Wrap a command body. Provides the per-invocation `Reporter` (built from the
|
|
30
|
+
* parsed flags) and renders any non-silent `CliError` through it before
|
|
31
|
+
* re-failing silently — so the dispatch edge (which has no Reporter) only needs
|
|
32
|
+
* to read the exit code. Services in the body's `R` are provided by the
|
|
33
|
+
* dispatch's `ServicesLive`.
|
|
34
|
+
*/
|
|
35
|
+
export declare function runHandler<R>(command: string, flags: ReporterFlags, body: Effect.Effect<void, CliError, R | Reporter>): Effect.Effect<void, CliError, R>;
|
|
36
|
+
//# sourceMappingURL=kit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kit.d.ts","sourceRoot":"","sources":["../../src/cli/kit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,QAAQ,EAA2B,MAAM,iBAAiB,CAAC;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAEvE,mFAAmF;AACnF,eAAO,MAAM,UAAU,0BAA2D,CAAC;AACnF,eAAO,MAAM,aAAa,0BAGzB,CAAC;AACF,eAAO,MAAM,WAAW,0BAGvB,CAAC;AACF,eAAO,MAAM,WAAW,0BAA4D,CAAC;AACrF,eAAO,MAAM,SAAS,yDAA6C,CAAC;AACpE,eAAO,MAAM,qBAAqB,yDAA2D,CAAC;AAC9F,eAAO,MAAM,eAAe,yDAAoD,CAAC;AACjF,eAAO,MAAM,eAAe,yDAAoD,CAAC;AACjF,eAAO,MAAM,YAAY,yDAAiD,CAAC;AAC3E,eAAO,MAAM,cAAc,yDAAmD,CAAC;AAC/E,eAAO,MAAM,WAAW,0BAA4D,CAAC;AACrF,eAAO,MAAM,SAAS,0BAGrB,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,GAC7B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAiB/B;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAC1B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,aAAa,EACpB,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC,GAAG,QAAQ,CAAC,GAChD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CAsBlC"}
|
package/dist/cli/kit.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as Options from '@effect/cli/Options';
|
|
2
|
+
import { Effect } from 'effect';
|
|
3
|
+
import { CliError, describeError, exitWith } from '../cli-error.js';
|
|
4
|
+
import * as ReporterSvc from '../services/reporter.js';
|
|
5
|
+
import { Reporter } from '../services/reporter.js';
|
|
6
|
+
/** Shared global options, declared once and spread into command option structs. */
|
|
7
|
+
export const jsonOption = Options.boolean('json').pipe(Options.withDefault(false));
|
|
8
|
+
export const verboseOption = Options.boolean('verbose').pipe(Options.withAlias('v'), Options.withDefault(false));
|
|
9
|
+
export const quietOption = Options.boolean('quiet').pipe(Options.withAlias('q'), Options.withDefault(false));
|
|
10
|
+
export const debugOption = Options.boolean('debug').pipe(Options.withDefault(false));
|
|
11
|
+
export const cwdOption = Options.text('cwd').pipe(Options.optional);
|
|
12
|
+
export const controlPlaneUrlOption = Options.text('control-plane-url').pipe(Options.optional);
|
|
13
|
+
export const accountIdOption = Options.text('account-id').pipe(Options.optional);
|
|
14
|
+
export const projectIdOption = Options.text('project-id').pipe(Options.optional);
|
|
15
|
+
export const userIdOption = Options.text('user-id').pipe(Options.optional);
|
|
16
|
+
export const deployIdOption = Options.text('deploy-id').pipe(Options.optional);
|
|
17
|
+
export const forceOption = Options.boolean('force').pipe(Options.withDefault(false));
|
|
18
|
+
export const yesOption = Options.boolean('yes').pipe(Options.withAlias('y'), Options.withDefault(false));
|
|
19
|
+
/**
|
|
20
|
+
* Quarantine seam for the heavy commands (deploy/dev/init/connect/login): run
|
|
21
|
+
* the existing imperative body (which renders its own success/handled-error
|
|
22
|
+
* output and returns a `CliResult`), and replicate the legacy direct
|
|
23
|
+
* dispatcher's catch exactly for a *thrown* error — `{ok:false,error}` on
|
|
24
|
+
* stdout in json mode, `Error: …` on stderr otherwise — then exit non-zero
|
|
25
|
+
* silently. This preserves byte-for-byte output through the Effect boundary.
|
|
26
|
+
*/
|
|
27
|
+
export function runQuarantined(json, body) {
|
|
28
|
+
return Effect.gen(function* () {
|
|
29
|
+
const result = yield* Effect.tryPromise({ try: body, catch: (cause) => cause }).pipe(Effect.catchAll((error) => Effect.sync(() => {
|
|
30
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
31
|
+
if (json) {
|
|
32
|
+
process.stdout.write(`${JSON.stringify({ ok: false, error: message }, null, 2)}\n`);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
process.stderr.write(`Error: ${message}\n`);
|
|
36
|
+
}
|
|
37
|
+
return { exitCode: 1 };
|
|
38
|
+
})));
|
|
39
|
+
if (result.exitCode !== 0)
|
|
40
|
+
return yield* Effect.fail(exitWith(result.exitCode));
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Wrap a command body. Provides the per-invocation `Reporter` (built from the
|
|
45
|
+
* parsed flags) and renders any non-silent `CliError` through it before
|
|
46
|
+
* re-failing silently — so the dispatch edge (which has no Reporter) only needs
|
|
47
|
+
* to read the exit code. Services in the body's `R` are provided by the
|
|
48
|
+
* dispatch's `ServicesLive`.
|
|
49
|
+
*/
|
|
50
|
+
export function runHandler(command, flags, body) {
|
|
51
|
+
return body.pipe(Effect.catchIf((error) => error instanceof CliError && !(error.silent ?? false), (error) => Effect.gen(function* () {
|
|
52
|
+
const reporter = yield* Reporter;
|
|
53
|
+
const described = describeError(error);
|
|
54
|
+
yield* reporter.error(described.code, described.message, described.context);
|
|
55
|
+
yield* reporter.done(undefined, described.exitCode);
|
|
56
|
+
return yield* Effect.fail(new CliError({
|
|
57
|
+
code: error.code,
|
|
58
|
+
message: error.message,
|
|
59
|
+
silent: true,
|
|
60
|
+
exitCode: described.exitCode,
|
|
61
|
+
}));
|
|
62
|
+
})), Effect.provide(ReporterSvc.layerFromFlags(command, flags)));
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=kit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kit.js","sourceRoot":"","sources":["../../src/cli/kit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEpE,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAsB,MAAM,yBAAyB,CAAC;AAEvE,mFAAmF;AACnF,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;AACnF,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,IAAI,CAC1D,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,EACtB,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAC3B,CAAC;AACF,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,CACtD,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,EACtB,OAAO,CAAC,WAAW,CAAC,KAAK,CAA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AAC,KAAK,YAAY,QAAQ,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,EACnF,CAAC,KAAK,EAAE,EAAE,CACR,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QAClB,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,QAAQ,CAAC;QACjC,MAAM,SAAS,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;QACvC,KAAK,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;QAC5E,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;QACpD,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CACvB,IAAI,QAAQ,CAAC;YACX,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,MAAM,EAAE,IAAI;YACZ,QAAQ,EAAE,SAAS,CAAC,QAAQ;SAC7B,CAAC,CACH,CAAC;IACJ,CAAC,CAAC,CACL,EACD,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAC3D,CAAC;AACJ,CAAC"}
|
package/dist/cli-error.d.ts
CHANGED
|
@@ -8,23 +8,41 @@ declare const CliError_base: new <A extends Record<string, any> = {}>(args: impo
|
|
|
8
8
|
* and the user-facing help block are derived at the dispatch edge. Handlers
|
|
9
9
|
* never call `process.exit` or write errors themselves — they `Effect.fail` a
|
|
10
10
|
* `CliError` and the edge maps it once.
|
|
11
|
+
*
|
|
12
|
+
* `silent` marks an error the handler has *already rendered* (or a pure
|
|
13
|
+
* exit-code signal like `validate` finding issues): the edge sets the exit code
|
|
14
|
+
* but does not re-render. `exitCode` overrides the registry lookup for codes
|
|
15
|
+
* that don't have a fixed registry entry.
|
|
11
16
|
*/
|
|
12
17
|
export declare class CliError extends CliError_base<{
|
|
13
18
|
readonly code: string;
|
|
14
19
|
readonly message: string;
|
|
15
20
|
readonly context?: ErrorContext;
|
|
21
|
+
readonly silent?: boolean;
|
|
22
|
+
readonly exitCode?: number;
|
|
16
23
|
}> {
|
|
17
24
|
}
|
|
25
|
+
export interface CliErrorOptions {
|
|
26
|
+
readonly context?: ErrorContext;
|
|
27
|
+
readonly silent?: boolean;
|
|
28
|
+
readonly exitCode?: number;
|
|
29
|
+
}
|
|
18
30
|
/**
|
|
19
31
|
* Construct a `CliError`. When `message` is omitted the registry summary for
|
|
20
32
|
* `code` is used, so callers can fail with just a code for well-known errors.
|
|
21
33
|
*/
|
|
22
|
-
export declare function cliError(code: string, message?: string,
|
|
34
|
+
export declare function cliError(code: string, message?: string, options?: CliErrorOptions): CliError;
|
|
35
|
+
/**
|
|
36
|
+
* Signal "the command rendered normally but must exit non-zero" (e.g.
|
|
37
|
+
* `validate`/`status` found issues). Silent — the edge only sets the code.
|
|
38
|
+
*/
|
|
39
|
+
export declare function exitWith(exitCode: number, code?: string): CliError;
|
|
23
40
|
export interface ErrorDescription {
|
|
24
41
|
readonly code: string;
|
|
25
42
|
readonly message: string;
|
|
26
43
|
readonly exitCode: number;
|
|
27
44
|
readonly context: ErrorContext | undefined;
|
|
45
|
+
readonly silent: boolean;
|
|
28
46
|
}
|
|
29
47
|
/**
|
|
30
48
|
* Normalize any caught defect/failure into the fields the reporter needs and
|
package/dist/cli-error.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-error.d.ts","sourceRoot":"","sources":["../src/cli-error.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;;;;AAExD
|
|
1
|
+
{"version":3,"file":"cli-error.d.ts","sourceRoot":"","sources":["../src/cli-error.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;;;;AAExD;;;;;;;;;;;GAWG;AACH,qBAAa,QAAS,SAAQ,cAA6B;IACzD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;CAAG;AAEL,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB,GAAG,QAAQ,CAQhG;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,SAAmB,GAAG,QAAQ,CAE5E;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,YAAY,GAAG,SAAS,CAAC;IAC3C,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAY9D"}
|
package/dist/cli-error.js
CHANGED
|
@@ -6,6 +6,11 @@ import { getError } from './errors-registry.js';
|
|
|
6
6
|
* and the user-facing help block are derived at the dispatch edge. Handlers
|
|
7
7
|
* never call `process.exit` or write errors themselves — they `Effect.fail` a
|
|
8
8
|
* `CliError` and the edge maps it once.
|
|
9
|
+
*
|
|
10
|
+
* `silent` marks an error the handler has *already rendered* (or a pure
|
|
11
|
+
* exit-code signal like `validate` finding issues): the edge sets the exit code
|
|
12
|
+
* but does not re-render. `exitCode` overrides the registry lookup for codes
|
|
13
|
+
* that don't have a fixed registry entry.
|
|
9
14
|
*/
|
|
10
15
|
export class CliError extends Data.TaggedError('CliError') {
|
|
11
16
|
}
|
|
@@ -13,13 +18,22 @@ export class CliError extends Data.TaggedError('CliError') {
|
|
|
13
18
|
* Construct a `CliError`. When `message` is omitted the registry summary for
|
|
14
19
|
* `code` is used, so callers can fail with just a code for well-known errors.
|
|
15
20
|
*/
|
|
16
|
-
export function cliError(code, message,
|
|
21
|
+
export function cliError(code, message, options = {}) {
|
|
17
22
|
return new CliError({
|
|
18
23
|
code,
|
|
19
24
|
message: message ?? getError(code)?.summary ?? code,
|
|
20
|
-
...(context ? { context } : {}),
|
|
25
|
+
...(options.context ? { context: options.context } : {}),
|
|
26
|
+
...(options.silent ? { silent: true } : {}),
|
|
27
|
+
...(options.exitCode !== undefined ? { exitCode: options.exitCode } : {}),
|
|
21
28
|
});
|
|
22
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Signal "the command rendered normally but must exit non-zero" (e.g.
|
|
32
|
+
* `validate`/`status` found issues). Silent — the edge only sets the code.
|
|
33
|
+
*/
|
|
34
|
+
export function exitWith(exitCode, code = 'HSX_E_INTERNAL') {
|
|
35
|
+
return new CliError({ code, message: '', silent: true, exitCode });
|
|
36
|
+
}
|
|
23
37
|
/**
|
|
24
38
|
* Normalize any caught defect/failure into the fields the reporter needs and
|
|
25
39
|
* the process exit code. Unknown errors (defects, raw `Error`s that escaped a
|
|
@@ -30,11 +44,12 @@ export function describeError(error) {
|
|
|
30
44
|
return {
|
|
31
45
|
code: error.code,
|
|
32
46
|
message: error.message,
|
|
33
|
-
exitCode: getError(error.code)?.exitCode ?? 1,
|
|
47
|
+
exitCode: error.exitCode ?? getError(error.code)?.exitCode ?? 1,
|
|
34
48
|
context: error.context,
|
|
49
|
+
silent: error.silent ?? false,
|
|
35
50
|
};
|
|
36
51
|
}
|
|
37
52
|
const message = error instanceof Error ? error.message : String(error);
|
|
38
|
-
return { code: 'HSX_E_INTERNAL', message, exitCode: 1, context: undefined };
|
|
53
|
+
return { code: 'HSX_E_INTERNAL', message, exitCode: 1, context: undefined, silent: false };
|
|
39
54
|
}
|
|
40
55
|
//# sourceMappingURL=cli-error.js.map
|
package/dist/cli-error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-error.js","sourceRoot":"","sources":["../src/cli-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGhD
|
|
1
|
+
{"version":3,"file":"cli-error.js","sourceRoot":"","sources":["../src/cli-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGhD;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,QAAS,SAAQ,IAAI,CAAC,WAAW,CAAC,UAAU,CAMvD;CAAG;AAQL;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,OAAgB,EAAE,UAA2B,EAAE;IACpF,OAAO,IAAI,QAAQ,CAAC;QAClB,IAAI;QACJ,OAAO,EAAE,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,IAAI,IAAI;QACnD,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACxD,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,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Command from '@effect/cli/Command';
|
|
2
|
+
import { type CliError } from '../cli-error.js';
|
|
3
|
+
import { AccountStore } from '../services/account-store.js';
|
|
4
|
+
import { Cwd } from '../services/cwd.js';
|
|
5
|
+
import { Option } from 'effect';
|
|
6
|
+
declare const whoamiCmd: Command.Command<"whoami", AccountStore, CliError, {
|
|
7
|
+
readonly json: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const accountCmd: Command.Command<"account", AccountStore | Cwd, CliError, {
|
|
10
|
+
readonly subcommand: Option.Option<{
|
|
11
|
+
readonly cwd: Option.Option<string>;
|
|
12
|
+
readonly json: boolean;
|
|
13
|
+
} | {
|
|
14
|
+
readonly cwd: Option.Option<string>;
|
|
15
|
+
readonly json: boolean;
|
|
16
|
+
} | {
|
|
17
|
+
readonly json: boolean;
|
|
18
|
+
} | {
|
|
19
|
+
readonly 'account-id': string;
|
|
20
|
+
readonly json: boolean;
|
|
21
|
+
} | {
|
|
22
|
+
readonly 'account-id': string;
|
|
23
|
+
readonly json: boolean;
|
|
24
|
+
} | {
|
|
25
|
+
readonly 'account-id': string;
|
|
26
|
+
readonly json: boolean;
|
|
27
|
+
} | {
|
|
28
|
+
readonly 'account-id': string;
|
|
29
|
+
readonly json: boolean;
|
|
30
|
+
}>;
|
|
31
|
+
}>;
|
|
32
|
+
export declare const accountsCmd: Command.Command<"accounts", AccountStore | Cwd, CliError, {
|
|
33
|
+
readonly subcommand: Option.Option<{
|
|
34
|
+
readonly cwd: Option.Option<string>;
|
|
35
|
+
readonly json: boolean;
|
|
36
|
+
} | {
|
|
37
|
+
readonly cwd: Option.Option<string>;
|
|
38
|
+
readonly json: boolean;
|
|
39
|
+
} | {
|
|
40
|
+
readonly json: boolean;
|
|
41
|
+
} | {
|
|
42
|
+
readonly 'account-id': string;
|
|
43
|
+
readonly json: boolean;
|
|
44
|
+
} | {
|
|
45
|
+
readonly 'account-id': string;
|
|
46
|
+
readonly json: boolean;
|
|
47
|
+
} | {
|
|
48
|
+
readonly 'account-id': string;
|
|
49
|
+
readonly json: boolean;
|
|
50
|
+
} | {
|
|
51
|
+
readonly 'account-id': string;
|
|
52
|
+
readonly json: boolean;
|
|
53
|
+
}>;
|
|
54
|
+
}>;
|
|
55
|
+
export { whoamiCmd };
|
|
7
56
|
//# sourceMappingURL=account.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/commands/account.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/commands/account.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAC;AAI/C,OAAO,EAAE,KAAK,QAAQ,EAAY,MAAM,iBAAiB,CAAC;AAK1D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AA8XhC,QAAA,MAAM,SAAS;;EAEd,CAAC;AA+DF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;EAUtB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;EAUvB,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC"}
|