@qvac/harness 0.8.10 → 0.8.12

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.
@@ -19,7 +19,7 @@ export function walkCommands(argv, schema) {
19
19
  }
20
20
  export function argvToObject(argv, schema) {
21
21
  const { node, pathSegs, index } = walkCommands(argv, schema);
22
- const leaf = parseParams(argv.slice(index), node);
22
+ const leaf = parseParams(argv.slice(index), node, pathSegs.join(' '));
23
23
  if (typeof leaf === 'string') {
24
24
  return leaf;
25
25
  }
@@ -52,7 +52,27 @@ function flagParts(tok) {
52
52
  }
53
53
  return { key: body.slice(0, ieq), inline: body.slice(ieq + 1) };
54
54
  }
55
- function parseParams(tokens, schema) {
55
+ function accepted(schema, command) {
56
+ const commands = [];
57
+ const params = [];
58
+ for (const [key, prop] of Object.entries(objectProps(schema))) {
59
+ if (isObjectSchema(prop)) {
60
+ commands.push(key);
61
+ }
62
+ else {
63
+ params.push(key);
64
+ }
65
+ }
66
+ const parts = [];
67
+ if (commands.length) {
68
+ parts.push(`commands: ${commands.join(', ')}`);
69
+ }
70
+ if (params.length) {
71
+ parts.push(`${command || 'it'} takes: ${params.join(', ')}`);
72
+ }
73
+ return parts.length ? `; ${parts.join('; ')}` : '';
74
+ }
75
+ function parseParams(tokens, schema, command) {
56
76
  const props = objectProps(schema);
57
77
  const propSchemas = new Map(Object.entries(props));
58
78
  const boolKeys = new Set(Object.entries(props)
@@ -77,7 +97,7 @@ function parseParams(tokens, schema) {
77
97
  continue;
78
98
  }
79
99
  if (!canAbsorb) {
80
- return `unknown parameter "${key}"`;
100
+ return `unknown parameter "${key}"${accepted(schema, command)}`;
81
101
  }
82
102
  }
83
103
  const flag = tok.startsWith('-') ? flagParts(tok) : null;
@@ -103,7 +123,7 @@ function parseParams(tokens, schema) {
103
123
  continue;
104
124
  }
105
125
  if (flag && !canAbsorb) {
106
- return `unknown flag "--${flag.key}"`;
126
+ return `unknown flag "--${flag.key}"${accepted(schema, command)}`;
107
127
  }
108
128
  if (boolKeys.has(tok)) {
109
129
  out[tok] = true;
@@ -131,7 +151,7 @@ function parseParams(tokens, schema) {
131
151
  i++;
132
152
  continue;
133
153
  }
134
- return `unexpected argument "${tok}"`;
154
+ return `unexpected argument "${tok}"${accepted(schema, command)}`;
135
155
  }
136
156
  if (restName && restVals.length > 0) {
137
157
  out[restName] = restVals;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qvac/harness",
3
- "version": "0.8.10",
3
+ "version": "0.8.12",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "bare": ">=1.34.0"
@@ -785,11 +785,11 @@
785
785
  },
786
786
  "dependencies": {
787
787
  "@qvac/error": "^0.1.1",
788
- "@qvac/inference": "^0.21.0",
788
+ "@qvac/inference": "^0.22.0",
789
789
  "@qvac/langdetect-text": "^0.1.2",
790
790
  "@qvac/logging": "0.1.1",
791
- "@qvac/sdk": "^0.21.0",
792
- "@qvac/skills": "0.1.15",
791
+ "@qvac/sdk": "^0.22.0",
792
+ "@qvac/skills": "^0.1.16",
793
793
  "@xmldom/xmldom": "^0.9.12",
794
794
  "asenion": "^0.1.0",
795
795
  "b4a": "^1.9.0",
@@ -861,7 +861,7 @@
861
861
  "patchedDependencies": {
862
862
  "pyodide@314.0.2": "patches/pyodide@314.0.2.patch",
863
863
  "localwatch@1.4.3": "patches/localwatch@1.4.3.patch",
864
- "@qvac/inference@0.21.0": "patches/@qvac%2Finference@0.21.0.patch"
864
+ "@qvac/inference@0.22.0": "patches/@qvac%2Finference@0.22.0.patch"
865
865
  },
866
866
  "repository": {
867
867
  "type": "git",