@effected/schemastore-cli 0.20.0 → 0.21.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 (3) hide show
  1. package/README.md +3 -1
  2. package/main.js +23 -11
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -154,13 +154,15 @@ Findings come back as values — `ValidationFinding` pointers into the document
154
154
 
155
155
  ## Exit codes
156
156
 
157
+ A failure is reported on stderr in the `@effected/cli` standard form: a status line naming the error and its message, the message's further lines, and, when the failure happened inside one of the command's spans, an `in: …` line naming them (a missing config, raised before any span, prints none). It is painted at a terminal, plain for an agent, and written for the log under GitHub Actions. Read the exit code, not the line's shape.
158
+
157
159
  | code | meaning |
158
160
  | ---- | -------------------------------------------------------------------------- |
159
161
  | 0 | success, including drift under `onDrift: warn` |
160
162
  | 1 | drift under `onDrift: error` (one line per drifting schema: `$id`, change, current and next version), a gate failure, a missing or mis-identified frozen version, a merged catalog blocked by a URL or name advertised twice or an invalid slice, — for `check` — anything `build` would write or an output nothing claims (an orphaned catalog slice or merged catalog, or an orphaned document at a sibling shape of a derived path), or — for `validate` — a payload that does not conform to the resolved document (one finding per problem, pointer and keyword each) |
161
163
  | 2 | config not found, failed to load, failed `defineConfig` validation, a `catalogDir` that is a file or cannot be listed (checked before anything is written), or — for `validate` — a payload that cannot be read or parsed, or a `--schema`/`$schema` reference that is neither an existing file nor an identity any config schema derives, or names a document that cannot be read or parsed |
162
164
  | 3 | infrastructure failure (for `validate`, an engine mechanism failure — a document the instance engine cannot compile — included) |
163
- | 64 | usage error (for `validate`, a payload with no `$schema` and no `--schema` given, included) |
165
+ | 64 | usage error (for `validate`, a payload with no `$schema` and no `--schema` given, included); `--wizard` is the kit's prompt-gated flag, so a run that is not interactive (a pipe, CI, an agent) leaves it out of help and rejects it at `64` (it was accepted at `0` before the command moved onto `CliRuntime.main`) |
164
166
 
165
167
  ## License
166
168
 
package/main.js CHANGED
@@ -1,22 +1,34 @@
1
1
  import { loggerLayer, program } from "./cli/program.js";
2
- import { Effect } from "effect";
3
2
  import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
4
3
  import * as NodeServices from "@effect/platform-node/NodeServices";
5
4
  import { CliRuntime } from "@effected/cli";
6
- import { CliError } from "effect/cli";
7
5
 
8
6
  //#region src/main.ts
9
- const render = (error) => CliError.isCliError(error) && error._tag === "ShowHelp" ? [] : [error instanceof Error ? error.message : String(error)];
7
+ /**
8
+ * How `CliRuntime.main` runs the command: the kit's standard failure report, exit `3` for a typed error that carries
9
+ * no code of its own (the infrastructure tier; every other code is marked where it is raised), and this module as the
10
+ * program's own, so the report's span trail keeps the command's spans when it is installed under
11
+ * `node_modules/@effected/` and leaves out the kit's.
12
+ */
13
+ const mainOptions = {
14
+ exitCode: 3,
15
+ logger: loggerLayer,
16
+ env: { appModule: import.meta.url }
17
+ };
18
+ /**
19
+ * The command under `CliRuntime.main` over `platform`: what `main` runs with `NodeServices.layer`, and what a test runs
20
+ * with a test `Command.Environment`.
21
+ */
22
+ const run = (args, deps, platform) => CliRuntime.main(program(args, deps), {
23
+ ...mainOptions,
24
+ platform
25
+ });
10
26
  const main = () => {
11
- const run = program(process.argv.slice(2), {
27
+ NodeRuntime.runMain(run(process.argv.slice(2), {
12
28
  cwd: process.cwd(),
13
- version: "0.20.0"
14
- }).pipe(Effect.provide(NodeServices.layer), CliRuntime.reportFailures({
15
- exitCode: 3,
16
- render
17
- }), Effect.provide(loggerLayer));
18
- NodeRuntime.runMain(run);
29
+ version: "0.21.0"
30
+ }, NodeServices.layer));
19
31
  };
20
32
 
21
33
  //#endregion
22
- export { main };
34
+ export { main, mainOptions, run };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effected/schemastore-cli",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "private": false,
5
5
  "description": "The schemastore command: build and check SchemaStore-shaped JSON Schema documents from a schemastore.config.ts, with a per-schema published flag and a drift policy.",
6
6
  "keywords": [
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "@effect/platform-node": "^4.0.0",
44
- "@effected/cli": "^0.11.0",
44
+ "@effected/cli": "^0.12.0",
45
45
  "@effected/env": "^0.1.0",
46
46
  "@effected/glob": "^0.10.0",
47
47
  "@effected/walker": "^0.15.0",
@@ -50,7 +50,7 @@
50
50
  "jiti": "^2.6.0"
51
51
  },
52
52
  "peerDependencies": {
53
- "@effected/schemastore": "0.20.0",
53
+ "@effected/schemastore": "0.21.0",
54
54
  "effect": "^4.0.0"
55
55
  },
56
56
  "engines": {