@ia-qa/cli 1.0.1 → 1.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/index.js +25 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -29,6 +29,9 @@ const DEFAULT_SERVER = (process.env.IAQA_SERVER || 'https://www.ia-qa.com').repl
|
|
|
29
29
|
const INLINE_MAX_CHARS = 4000;
|
|
30
30
|
const INLINE_MAX_LINES = 100;
|
|
31
31
|
|
|
32
|
+
// Own version, for caller identification (so the server can label CLI traffic).
|
|
33
|
+
const VERSION = (() => { try { return require('./package.json').version; } catch { return '0'; } })();
|
|
34
|
+
|
|
32
35
|
// ── argv parsing (no dependency) ─────────────────────────────────────────────
|
|
33
36
|
|
|
34
37
|
function parseArgv(argv) {
|
|
@@ -37,7 +40,15 @@ function parseArgv(argv) {
|
|
|
37
40
|
for (let i = 0; i < argv.length; i++) {
|
|
38
41
|
const tok = argv[i];
|
|
39
42
|
if (tok.startsWith('--')) {
|
|
40
|
-
const
|
|
43
|
+
const bodyTok = tok.slice(2);
|
|
44
|
+
const eq = bodyTok.indexOf('=');
|
|
45
|
+
if (eq !== -1) {
|
|
46
|
+
const key = bodyTok.slice(0, eq);
|
|
47
|
+
const val = bodyTok.slice(eq + 1);
|
|
48
|
+
flags[key] = flags[key] === undefined ? val : [].concat(flags[key], val);
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
const key = bodyTok;
|
|
41
52
|
const next = argv[i + 1];
|
|
42
53
|
if (next === undefined || next.startsWith('--')) {
|
|
43
54
|
flags[key] = flags[key] === undefined ? true : flags[key];
|
|
@@ -115,8 +126,9 @@ async function callTool(server, name, parameters) {
|
|
|
115
126
|
try {
|
|
116
127
|
res = await fetch(`${server}/mcp/call`, {
|
|
117
128
|
method: 'POST',
|
|
118
|
-
headers: { 'Content-Type': 'application/json', '
|
|
119
|
-
|
|
129
|
+
headers: { 'Content-Type': 'application/json', 'User-Agent': `ia-qa-cli/${VERSION}` },
|
|
130
|
+
// `_meta.agent` is the MCP-standard field the server reads to identify the caller.
|
|
131
|
+
body: JSON.stringify({ name, parameters, _meta: { agent: 'ia-qa-cli', version: VERSION } }),
|
|
120
132
|
});
|
|
121
133
|
} catch (e) {
|
|
122
134
|
throw new CliError(`Cannot reach ia-qa server at ${server} (${e.message}). Set --server or $IAQA_SERVER.`, 1);
|
|
@@ -189,7 +201,7 @@ function compactHelp(m) {
|
|
|
189
201
|
' ia-qa base64_encode "hello"',
|
|
190
202
|
" echo '{\"a\":1}' | ia-qa format_json --stdin --json",
|
|
191
203
|
'',
|
|
192
|
-
`Runs on ${DEFAULT_SERVER} (override with --server or $IAQA_SERVER). No key,
|
|
204
|
+
`Runs on ${DEFAULT_SERVER} (override with --server or $IAQA_SERVER). No signup; most tools key-free, BYOK for LLM tools.`,
|
|
193
205
|
].join('\n');
|
|
194
206
|
}
|
|
195
207
|
|
|
@@ -274,8 +286,16 @@ async function main(argv) {
|
|
|
274
286
|
process.stderr.write(`⚠ Sending secret param(s) [${secretKeys.join(', ')}] to ${server} — make sure you trust this server (set via --server/$IAQA_SERVER).\n`);
|
|
275
287
|
}
|
|
276
288
|
|
|
289
|
+
let outPath = null;
|
|
290
|
+
if (flags.out !== undefined) {
|
|
291
|
+
if (typeof flags.out !== 'string') {
|
|
292
|
+
throw new CliError('--out needs a single file path, e.g. --out result.json', 2);
|
|
293
|
+
}
|
|
294
|
+
outPath = flags.out;
|
|
295
|
+
}
|
|
296
|
+
|
|
277
297
|
const data = await callTool(server, tool.name, params);
|
|
278
|
-
process.stdout.write(emit(data, { json: !!flags.json, out:
|
|
298
|
+
process.stdout.write(emit(data, { json: !!flags.json, out: outPath, toolName: tool.name }) + '\n');
|
|
279
299
|
}
|
|
280
300
|
|
|
281
301
|
if (require.main === module) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ia-qa/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
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",
|