argsbarg 7.0.0 → 7.0.3

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/CHANGELOG.md CHANGED
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [7.0.3] - 2026-08-13
11
+
12
+ ### Fixed
13
+
14
+ - **Partial config validation** — skip attaching empty `definitions` / `$defs` companion schemas (fixes `Duplicate schema URI "https://github.com/cfworker"` when schemagen emits `"definitions": {}`).
15
+
16
+ ## [7.0.2] - 2026-08-13
17
+
18
+
19
+ ## [7.0.1] - 2026-08-13
20
+
21
+ ### Fixed
22
+
23
+ - **`configure install` / `uninstall` / `status`** — skip the global required-`appConfig` gate so these subcommands reach their handlers (e.g. `configure uninstall` when config is incomplete).
24
+
10
25
  ## [7.0.0] - 2026-08-13
11
26
 
12
27
  ### Changed
@@ -938,7 +953,10 @@ const cli = { ... } satisfies CliProgram; // or : CliProgram
938
953
  - Migrate schemas: rename every `children` property to **`commands`**; move positional definitions to **`CliPositional`** objects on `positionals` and strip `positional` / `argMin` / `argMax` from flag definitions under `options` (flags only carry `name`, `description`, `kind`, and optional `shortName`).
939
954
  - Imports: use `CliPositional` where needed; replace `CliOptionDef` with `CliOption` or `CliPositional` as appropriate.
940
955
 
941
- [Unreleased]: https://github.com/bdombro/bun-argsbarg/compare/v7.0.0...HEAD
956
+ [Unreleased]: https://github.com/bdombro/bun-argsbarg/compare/v7.0.3...HEAD
957
+ [7.0.3]: https://github.com/bdombro/bun-argsbarg/releases/tag/v7.0.3
958
+ [7.0.2]: https://github.com/bdombro/bun-argsbarg/releases/tag/v7.0.2
959
+ [7.0.1]: https://github.com/bdombro/bun-argsbarg/releases/tag/v7.0.1
942
960
  [7.0.0]: https://github.com/bdombro/bun-argsbarg/releases/tag/v7.0.0
943
961
  [6.3.2]: https://github.com/bdombro/bun-argsbarg/releases/tag/v6.3.2
944
962
  [6.3.1]: https://github.com/bdombro/bun-argsbarg/releases/tag/v6.3.1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "argsbarg",
3
- "version": "7.0.0",
3
+ "version": "7.0.3",
4
4
  "main": "./src/index.ts",
5
5
  "module": "./src/index.ts",
6
6
  "dependencies": {
@@ -3,7 +3,12 @@ Tests for config/validate module behavior.
3
3
  */
4
4
 
5
5
  import { describe, expect, test } from "bun:test";
6
- import { parseConfigSetValue, resolveSchemaDraft, validateConfigDocument } from "./validate.ts";
6
+ import {
7
+ parseConfigSetValue,
8
+ resolveSchemaDraft,
9
+ validateConfigDocument,
10
+ validateConfigDocumentPartial,
11
+ } from "./validate.ts";
7
12
 
8
13
  const rootSchema = {
9
14
  type: "object",
@@ -121,6 +126,21 @@ describe("config/validate", () => {
121
126
  expect(validateConfigDocument({}, schema).valid).toBe(false);
122
127
  });
123
128
 
129
+ test("validateConfigDocumentPartial accepts schemagen root with empty definitions", () => {
130
+ const schema = {
131
+ $schema: "http://json-schema.org/draft-07/schema#",
132
+ type: "object",
133
+ additionalProperties: false,
134
+ required: ["email"],
135
+ properties: {
136
+ email: { type: "string" },
137
+ services: { type: "array", items: { type: "string" } },
138
+ },
139
+ definitions: {},
140
+ };
141
+ expect(validateConfigDocumentPartial({ email: "a@example.com", services: ["a"] }, schema).valid).toBe(true);
142
+ });
143
+
124
144
  test("validates draft 2020-12 $defs refs", () => {
125
145
  const schema = {
126
146
  $schema: "https://json-schema.org/draft/2020-12/schema",
@@ -129,10 +129,20 @@ function attachRootCompanionSchemas(validator: Validator, root: JsonSchema, acti
129
129
  return;
130
130
  }
131
131
  const companion: Schema = {};
132
- if (typeof root.definitions === "object" && root.definitions !== null && !Array.isArray(root.definitions)) {
132
+ if (
133
+ typeof root.definitions === "object" &&
134
+ root.definitions !== null &&
135
+ !Array.isArray(root.definitions) &&
136
+ Object.keys(root.definitions).length > 0
137
+ ) {
133
138
  companion.definitions = root.definitions;
134
139
  }
135
- if (typeof root.$defs === "object" && root.$defs !== null && !Array.isArray(root.$defs)) {
140
+ if (
141
+ typeof root.$defs === "object" &&
142
+ root.$defs !== null &&
143
+ !Array.isArray(root.$defs) &&
144
+ Object.keys(root.$defs).length > 0
145
+ ) {
136
146
  companion.$defs = root.$defs;
137
147
  }
138
148
  if (Object.keys(companion).length > 0) {
@@ -247,6 +247,9 @@ test("skipsRequiredAppConfigExit includes docs and config builtins", () => {
247
247
  const caps = resolveCapabilities(program);
248
248
  expect(skipsRequiredAppConfigExit(["docs", "cli"], caps)).toBe(true);
249
249
  expect(skipsRequiredAppConfigExit(["configure", "get"], caps)).toBe(true);
250
+ expect(skipsRequiredAppConfigExit(["configure", "install"], caps)).toBe(true);
251
+ expect(skipsRequiredAppConfigExit(["configure", "uninstall"], caps)).toBe(true);
252
+ expect(skipsRequiredAppConfigExit(["configure", "status"], caps)).toBe(true);
250
253
  expect(skipsRequiredAppConfigExit(["run"], caps)).toBe(false);
251
254
  });
252
255
 
@@ -50,12 +50,12 @@ export function reservedCommandNames(caps: CliCapabilities): string[] {
50
50
  return names;
51
51
  }
52
52
 
53
- /** Commands that may run without required appConfig values (read-only / config introspection). */
53
+ /** Commands that may run without required appConfig values (read-only / config introspection / lifecycle). */
54
54
  export function skipsRequiredAppConfigExit(path: string[], caps: CliCapabilities): boolean {
55
55
  const root = path[0];
56
- if (root === "configure" && caps.configCommands) {
56
+ if (root === "configure" && caps.configure) {
57
57
  const sub = path[1];
58
- if (sub === "get" || sub === "set") {
58
+ if (!sub || sub === "get" || sub === "set" || sub === "install" || sub === "uninstall" || sub === "status") {
59
59
  return true;
60
60
  }
61
61
  }