argsbarg 5.0.2 → 5.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/src/parse.test.ts CHANGED
@@ -120,7 +120,6 @@ test("fallback missing or unknown root flags", () => {
120
120
  expect(pr.opts.name).toBe("bob");
121
121
  });
122
122
 
123
- /** Tests that unknown command. */
124
123
  test("unknown command", () => {
125
124
  const root = testProgram({
126
125
  key: "app",
@@ -133,7 +132,6 @@ test("unknown command", () => {
133
132
  expect(pr.errorMsg).toContain("Unknown command");
134
133
  });
135
134
 
136
- /** Tests that implicit help empty. */
137
135
  test("implicit help empty", () => {
138
136
  const root = testProgram({
139
137
  key: "app",
@@ -504,7 +502,6 @@ test("presence option cannot be required", () => {
504
502
  expect(() => cliValidateProgram(root)).toThrow(/Presence option cannot be required/);
505
503
  });
506
504
 
507
- /** Leaf completion help prints correctly. */
508
505
  test("leaf completion help prints correctly", async () => {
509
506
  // Test the fix where `completion zsh -h` on a leaf root was incorrectly ignored.
510
507
  // We run this as a subprocess so we don't accidentally exit the test runner.
@@ -553,14 +550,12 @@ test("docs schema exports JSON for leaf roots", async () => {
553
550
  ]);
554
551
  });
555
552
 
556
- /** Tests that version builtin prints program version. */
557
553
  test("version builtin prints program version", async () => {
558
554
  const { stdout, exitCode } = await $`bun run examples/nested.ts version`.nothrow().quiet();
559
555
  expect(exitCode).toBe(0);
560
556
  expect(stdout.toString().trim()).toMatch(/^\d+\.\d+\.\d+/);
561
557
  });
562
558
 
563
- /** Leaf root help omits hidden completion built-in. */
564
559
  test("leaf root help omits hidden completion built-in", async () => {
565
560
  const { stdout, exitCode } = await $`bun run examples/minimal.ts -h`.nothrow().quiet();
566
561
  expect(exitCode).toBe(0);
@@ -724,7 +719,6 @@ test("root help shows agent docs hint when docs enabled", () => {
724
719
  expect(help).not.toContain("install --skill");
725
720
  });
726
721
 
727
- /** Root help omits agent hint when docs disabled. */
728
722
  test("root help omits agent hint when docs disabled", () => {
729
723
  const root = testProgram({
730
724
  key: "myapp",
@@ -755,7 +749,6 @@ test("root help includes program notes and agent hint", () => {
755
749
  expect(help).toContain("myapp docs skill");
756
750
  });
757
751
 
758
- /** Enum option inputSchema includes enum array. */
759
752
  test("Enum option inputSchema includes enum array", () => {
760
753
  const tools = collectMcpTools(enumMcpFixture);
761
754
  const run = tools.find((t) => t.name === "run")!;
@@ -763,7 +756,6 @@ test("Enum option inputSchema includes enum array", () => {
763
756
  expect(schema.properties.mode.enum).toEqual(["dev", "prod"]);
764
757
  });
765
758
 
766
- /** CliValidateProgram rejects Enum with no choices. */
767
759
  test("cliValidateProgram rejects Enum with no choices", () => {
768
760
  const root = testProgram({
769
761
  key: "app",
@@ -774,7 +766,6 @@ test("cliValidateProgram rejects Enum with no choices", () => {
774
766
  expect(() => cliValidateProgram(root)).toThrow(/requires non-empty choices/);
775
767
  });
776
768
 
777
- /** CliValidateProgram rejects Enum with duplicate choices. */
778
769
  test("cliValidateProgram rejects Enum with duplicate choices", () => {
779
770
  const root = testProgram({
780
771
  key: "app",
@@ -804,7 +795,6 @@ test("mcpTool.description override wins without env suffix", () => {
804
795
  expect(tools[0]?.description).toBe("custom");
805
796
  });
806
797
 
807
- /** CliValidateProgram requires program.appConfig description. */
808
798
  test("cliValidateProgram requires program.appConfig description", () => {
809
799
  const root = testProgram({
810
800
  key: "app",
@@ -832,7 +822,6 @@ test("cliValidateProgram rejects duplicate mcpResources URIs", () => {
832
822
  expect(() => cliValidateProgram(root)).toThrow(/URIs must be unique/);
833
823
  });
834
824
 
835
- /** CliValidateProgram rejects empty mcpServer. */
836
825
  test("cliValidateProgram rejects empty mcpServer", () => {
837
826
  const root = testProgram({
838
827
  key: "app",
@@ -843,7 +832,6 @@ test("cliValidateProgram rejects empty mcpServer", () => {
843
832
  expect(() => cliValidateProgram(root)).toThrow(/mcpServer requires enabled: true/);
844
833
  });
845
834
 
846
- /** ResolveMcpSchemaUri uses sanitized root key. */
847
835
  test("resolveMcpSchemaUri uses sanitized root key", () => {
848
836
  const root = testProgram({
849
837
  key: "nested.ts",
@@ -854,7 +842,6 @@ test("resolveMcpSchemaUri uses sanitized root key", () => {
854
842
  expect(resolveMcpSchemaUri(root)).toBe("nested_ts://schema");
855
843
  });
856
844
 
857
- /** ResolveMcpSchemaUri uses plain key when alphanumeric. */
858
845
  test("resolveMcpSchemaUri uses plain key when alphanumeric", () => {
859
846
  const root = testProgram({
860
847
  key: "qa",
@@ -865,7 +852,6 @@ test("resolveMcpSchemaUri uses plain key when alphanumeric", () => {
865
852
  expect(resolveMcpSchemaUri(root)).toBe("qa://schema");
866
853
  });
867
854
 
868
- /** CliValidateProgram rejects resource URI matching default schema URI. */
869
855
  test("cliValidateProgram rejects resource URI matching default schema URI", () => {
870
856
  const root = testProgram({
871
857
  key: "app",
@@ -982,7 +968,6 @@ test("Enum completions list choices in bash script", () => {
982
968
  expect(bash).toContain("prod");
983
969
  });
984
970
 
985
- /** Nested fallback routes to default when argv exhausted at router. */
986
971
  test("nested fallback routes to default when argv exhausted at router", () => {
987
972
  const root = nestedDocsFallbackFixture();
988
973
  cliValidateProgram(root);
@@ -1033,7 +1018,6 @@ test("nested fallback MissingOrUnknown routes unknown token to default", () => {
1033
1018
  expect(pr.args).toEqual(["extra-topic"]);
1034
1019
  });
1035
1020
 
1036
- /** Nested fallback MissingOnly errors on unknown subcommand. */
1037
1021
  test("nested fallback MissingOnly errors on unknown subcommand", () => {
1038
1022
  const root = nestedDocsFallbackFixture();
1039
1023
  cliValidateProgram(root);
@@ -1067,13 +1051,11 @@ test("cliValidateProgram rejects invalid nested fallbackCommand", () => {
1067
1051
  );
1068
1052
  });
1069
1053
 
1070
- /** CliValidateProgram accepts nested fallbackCommand when child exists. */
1071
1054
  test("cliValidateProgram accepts nested fallbackCommand when child exists", () => {
1072
1055
  const root = nestedDocsFallbackFixture();
1073
1056
  expect(() => cliValidateProgram(root)).not.toThrow();
1074
1057
  });
1075
1058
 
1076
- /** Nested router scoped help does not route to fallback. */
1077
1059
  test("nested router scoped help does not route to fallback", () => {
1078
1060
  const root = nestedDocsFallbackFixture();
1079
1061
  cliValidateProgram(root);
@@ -1086,7 +1068,6 @@ test("nested router scoped help does not route to fallback", () => {
1086
1068
  expect(help).toContain("guide");
1087
1069
  });
1088
1070
 
1089
- /** Varargs trailing option after positionals via Cli.invoke. */
1090
1071
  test("varargs trailing option after positionals via Cli.invoke", async () => {
1091
1072
  const root = varargsReadFixture();
1092
1073
  cliValidateProgram(root);
@@ -1096,7 +1077,6 @@ test("varargs trailing option after positionals via Cli.invoke", async () => {
1096
1077
  expect(pr.opts.json).toBe("1");
1097
1078
  });
1098
1079
 
1099
- /** Varargs option before positionals. */
1100
1080
  test("varargs option before positionals", () => {
1101
1081
  const root = varargsReadFixture();
1102
1082
  cliValidateProgram(root);
@@ -1106,7 +1086,6 @@ test("varargs option before positionals", () => {
1106
1086
  expect(pr.opts.json).toBe("1");
1107
1087
  });
1108
1088
 
1109
- /** Varargs multiple files then trailing option. */
1110
1089
  test("varargs multiple files then trailing option", () => {
1111
1090
  const root = varargsReadFixture();
1112
1091
  cliValidateProgram(root);
@@ -1116,7 +1095,6 @@ test("varargs multiple files then trailing option", () => {
1116
1095
  expect(pr.opts.json).toBe("1");
1117
1096
  });
1118
1097
 
1119
- /** Varargs double dash forces positional. */
1120
1098
  test("varargs double dash forces positional", () => {
1121
1099
  const root = varargsReadFixture();
1122
1100
  cliValidateProgram(root);
@@ -1126,7 +1104,6 @@ test("varargs double dash forces positional", () => {
1126
1104
  expect(pr.opts.json).toBeUndefined();
1127
1105
  });
1128
1106
 
1129
- /** Varargs unknown flag errors. */
1130
1107
  test("varargs unknown flag errors", async () => {
1131
1108
  const root = varargsReadFixture();
1132
1109
  cliValidateProgram(root);
@@ -1135,7 +1112,6 @@ test("varargs unknown flag errors", async () => {
1135
1112
  expect(result.stderr).toContain("--unknown");
1136
1113
  });
1137
1114
 
1138
- /** McpToolCallToArgv rejects comma-separated string for varargs. */
1139
1115
  test("mcpToolCallToArgv rejects comma-separated string for varargs", () => {
1140
1116
  const tools = collectMcpTools(nestedMcpFixture);
1141
1117
  const read = tools.find((t) => t.name === "read")!;
@@ -1143,7 +1119,6 @@ test("mcpToolCallToArgv rejects comma-separated string for varargs", () => {
1143
1119
  expect(argv).toEqual({ error: expect.stringContaining("JSON array") });
1144
1120
  });
1145
1121
 
1146
- /** McpToolCallToArgv rejects bare string for varargs. */
1147
1122
  test("mcpToolCallToArgv rejects bare string for varargs", () => {
1148
1123
  const tools = collectMcpTools(nestedMcpFixture);
1149
1124
  const read = tools.find((t) => t.name === "read")!;
@@ -1151,7 +1126,6 @@ test("mcpToolCallToArgv rejects bare string for varargs", () => {
1151
1126
  expect(argv).toEqual({ error: expect.stringContaining("JSON array") });
1152
1127
  });
1153
1128
 
1154
- /** McpToolCallToArgv array varargs unchanged. */
1155
1129
  test("mcpToolCallToArgv array varargs unchanged", () => {
1156
1130
  const tools = collectMcpTools(nestedMcpFixture);
1157
1131
  const read = tools.find((t) => t.name === "read")!;
@@ -1159,7 +1133,6 @@ test("mcpToolCallToArgv array varargs unchanged", () => {
1159
1133
  expect(argv).toEqual(["read", "a", "b"]);
1160
1134
  });
1161
1135
 
1162
- /** McpToolCallToArgv empty array varargs errors when required. */
1163
1136
  test("mcpToolCallToArgv empty array varargs errors when required", () => {
1164
1137
  const tools = collectMcpTools(nestedMcpFixture);
1165
1138
  const read = tools.find((t) => t.name === "read")!;
@@ -1187,7 +1160,6 @@ test("configure config on non-root node is rejected", () => {
1187
1160
  expect(() => cliValidateProgram(root)).toThrow(/configure is only supported on the program root/);
1188
1161
  });
1189
1162
 
1190
- /** Configure.prefix is rejected. */
1191
1163
  test("configure.prefix is rejected", () => {
1192
1164
  const root = {
1193
1165
  key: "app",