open-tag 0.0.1 → 0.0.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.
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env node
2
+ import { B as resolveOpenTagHomeLayout, I as presentCommand, L as toCommandError, M as CommandError, N as EXIT_CODES, O as CommanderError, P as commandExitCode, R as configureClientLoggerForService, S as resolveChannelEnvironment, t as createProgram, z as resolveOpenTagHome } from "../program-enU8tS6o.mjs";
3
+ //#region src/cli/index.ts
4
+ const json = process.argv.includes("--json");
5
+ try {
6
+ const environment = resolveChannelEnvironment(process.env);
7
+ const home = resolveOpenTagHome(environment);
8
+ configureClientLoggerForService(resolveOpenTagHomeLayout(home).logs);
9
+ await createProgram({ json }).parseAsync(process.argv);
10
+ } catch (error) {
11
+ if (error instanceof CommanderError) {
12
+ if (error.exitCode !== 0 && json) {
13
+ const commandError = new CommandError({
14
+ code: "USAGE_ERROR",
15
+ category: "validation",
16
+ retryability: "never",
17
+ phase: "validation"
18
+ }, error.message);
19
+ presentCommand({
20
+ ok: false,
21
+ error: commandError,
22
+ exitCode: EXIT_CODES.usage
23
+ }, { json: true });
24
+ }
25
+ process.exit(error.exitCode === 0 ? 0 : EXIT_CODES.usage);
26
+ } else {
27
+ const commandError = toCommandError(error);
28
+ const result = {
29
+ ok: false,
30
+ error: commandError,
31
+ exitCode: commandExitCode(commandError)
32
+ };
33
+ process.exitCode = presentCommand(result, { json });
34
+ }
35
+ }
36
+ //#endregion
37
+ export {};
38
+
39
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/cli/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { configureClientLoggerForService, resolveOpenTagHome, resolveOpenTagHomeLayout } from \"@opentag/client\";\nimport { CommanderError } from \"commander\";\nimport { resolveChannelEnvironment } from \"../core/channel/environment.js\";\nimport {\n CommandError,\n type CommandResult,\n commandExitCode,\n EXIT_CODES,\n presentCommand,\n toCommandError,\n} from \"../core/command/policy.js\";\nimport { createProgram } from \"./program.js\";\n\nconst json = process.argv.includes(\"--json\");\ntry {\n const environment = resolveChannelEnvironment(process.env);\n const home = resolveOpenTagHome(environment);\n configureClientLoggerForService(resolveOpenTagHomeLayout(home).logs);\n await createProgram({ json }).parseAsync(process.argv);\n} catch (error) {\n // Commander usage errors (unknown options, missing required options or arguments) are\n // input-validation failures: they exit 2, and a --json caller receives the same failure\n // envelope as any other command instead of human help text.\n if (error instanceof CommanderError) {\n if (error.exitCode !== 0 && json) {\n const commandError = new CommandError(\n { code: \"USAGE_ERROR\", category: \"validation\", retryability: \"never\", phase: \"validation\" },\n error.message,\n );\n presentCommand({ ok: false, error: commandError, exitCode: EXIT_CODES.usage }, { json: true });\n }\n process.exit(error.exitCode === 0 ? 0 : EXIT_CODES.usage);\n } else {\n const commandError = toCommandError(error);\n const result: CommandResult<never> = {\n ok: false,\n error: commandError,\n exitCode: commandExitCode(commandError),\n };\n process.exitCode = presentCommand(result, { json });\n }\n}\n"],"mappings":";;;AAeA,MAAM,OAAO,QAAQ,KAAK,SAAS,QAAQ;AAC3C,IAAI;CACF,MAAM,cAAc,0BAA0B,QAAQ,GAAG;CACzD,MAAM,OAAO,mBAAmB,WAAW;CAC3C,gCAAgC,yBAAyB,IAAI,CAAC,CAAC,IAAI;CACnE,MAAM,cAAc,EAAE,KAAK,CAAC,CAAC,CAAC,WAAW,QAAQ,IAAI;AACvD,SAAS,OAAO;CAId,IAAI,iBAAiB,gBAAgB;EACnC,IAAI,MAAM,aAAa,KAAK,MAAM;GAChC,MAAM,eAAe,IAAI,aACvB;IAAE,MAAM;IAAe,UAAU;IAAc,cAAc;IAAS,OAAO;GAAa,GAC1F,MAAM,OACR;GACA,eAAe;IAAE,IAAI;IAAO,OAAO;IAAc,UAAU,WAAW;GAAM,GAAG,EAAE,MAAM,KAAK,CAAC;EAC/F;EACA,QAAQ,KAAK,MAAM,aAAa,IAAI,IAAI,WAAW,KAAK;CAC1D,OAAO;EACL,MAAM,eAAe,eAAe,KAAK;EACzC,MAAM,SAA+B;GACnC,IAAI;GACJ,OAAO;GACP,UAAU,gBAAgB,YAAY;EACxC;EACA,QAAQ,WAAW,eAAe,QAAQ,EAAE,KAAK,CAAC;CACpD;AACF"}