@ia-qa/cli 1.0.3 → 1.0.6
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/index.js +29 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* them on the hosted server (https://www.ia-qa.com). 148 QA/LLM/dev tools, no signup, no key.
|
|
10
10
|
*
|
|
11
11
|
* ia-qa <tool> [input] [--flag value] [--json] [--out <file>] [--stdin]
|
|
12
|
+
* ia-qa <tool> --<param>-file <path> # read a param from a file (multiline-safe)
|
|
12
13
|
* ia-qa list [--category <c>]
|
|
13
14
|
* ia-qa <tool> --help
|
|
14
15
|
* ia-qa --help
|
|
@@ -229,10 +230,36 @@ function toolHelp(tool) {
|
|
|
229
230
|
}
|
|
230
231
|
}
|
|
231
232
|
if (primary) lines.push('', `Primary input "${primary}" can be given positionally or via --stdin.`);
|
|
233
|
+
lines.push('', 'Any --<param> also accepts --<param>-file <path> (multiline-safe, e.g. --inputs-file fields.txt).');
|
|
232
234
|
lines.push('', 'Common: --json --out <file> --stdin --server <url>');
|
|
233
235
|
return lines.join('\n');
|
|
234
236
|
}
|
|
235
237
|
|
|
238
|
+
// ── file-backed params (--<param>-file) ─────────────────────────────────────
|
|
239
|
+
// Read a param's value from a file instead of argv. This sidesteps shells that
|
|
240
|
+
// mangle argv: on Windows, `npx` re-spawns the resolved binary through a cmd.exe
|
|
241
|
+
// hop that truncates any argument at its first newline, so a multiline value
|
|
242
|
+
// (e.g. --inputs with one field per line) silently loses everything after line 1.
|
|
243
|
+
// A file never transits argv, so it survives regardless of the invoker.
|
|
244
|
+
function readFileParams(props, flags, readFile = (p) => fs.readFileSync(p, 'utf8')) {
|
|
245
|
+
const out = {};
|
|
246
|
+
for (const k of Object.keys(props)) {
|
|
247
|
+
const fk = `${k}-file`;
|
|
248
|
+
if (flags[fk] === undefined) continue;
|
|
249
|
+
if (typeof flags[fk] !== 'string') {
|
|
250
|
+
throw new CliError(`--${fk} needs a single file path, e.g. --${fk} ${k}.txt`, 2);
|
|
251
|
+
}
|
|
252
|
+
if (flags[k] !== undefined) {
|
|
253
|
+
throw new CliError(`Pass either --${k} or --${fk}, not both.`, 2);
|
|
254
|
+
}
|
|
255
|
+
let raw;
|
|
256
|
+
try { raw = readFile(path.resolve(flags[fk])); }
|
|
257
|
+
catch (e) { throw new CliError(`Cannot read --${fk} "${flags[fk]}": ${e.message}`, 2); }
|
|
258
|
+
out[k] = coerce(props[k], raw.replace(/\r?\n$/, ''));
|
|
259
|
+
}
|
|
260
|
+
return out;
|
|
261
|
+
}
|
|
262
|
+
|
|
236
263
|
// ── main ─────────────────────────────────────────────────────────────────────
|
|
237
264
|
|
|
238
265
|
async function main(argv) {
|
|
@@ -269,6 +296,7 @@ async function main(argv) {
|
|
|
269
296
|
for (const [k, prop] of Object.entries(props)) {
|
|
270
297
|
if (flags[k] !== undefined) params[k] = coerce(prop, flags[k]);
|
|
271
298
|
}
|
|
299
|
+
Object.assign(params, readFileParams(props, flags));
|
|
272
300
|
const primary = primaryParam(schema);
|
|
273
301
|
if (primary) {
|
|
274
302
|
if (flags.stdin || positional[0] === '-') params[primary] = fs.readFileSync(0, 'utf8').replace(/\n$/, '');
|
|
@@ -305,4 +333,4 @@ if (require.main === module) {
|
|
|
305
333
|
});
|
|
306
334
|
}
|
|
307
335
|
|
|
308
|
-
module.exports = { main, parseArgv, coerce, parseBool, primaryParam, emit, isLarge, compactHelp, listTools, toolHelp };
|
|
336
|
+
module.exports = { main, parseArgv, coerce, parseBool, primaryParam, readFileParams, emit, isLarge, compactHelp, listTools, toolHelp };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ia-qa/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Run ia-qa.com's 148 QA/LLM/dev tools from your shell — for AI agents (Claude Code, Copilot CLI) and humans. Zero dependencies, no signup; most tools key-free, BYOK for the LLM-powered ones.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ia-qa",
|