@lotics/cli 0.48.0 → 0.49.0
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/README.md +4 -1
- package/dist/cli.js +22 -2
- package/dist/src/cli.js +16 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -102,7 +102,10 @@ lotics tools query_records # show full description + input schema
|
|
|
102
102
|
lotics run query_tables '{}'
|
|
103
103
|
lotics run query_records '{"table_id":"tbl_...","field_keys":["name"]}'
|
|
104
104
|
|
|
105
|
-
#
|
|
105
|
+
# Large args (a knowledge-doc `content`, a bulk update) exceed the OS arg limit —
|
|
106
|
+
# read them from a file or stdin instead of an inline arg:
|
|
107
|
+
lotics run create_knowledge @args.json
|
|
108
|
+
cat args.json | lotics run create_knowledge
|
|
106
109
|
echo '{"table_id":"tbl_..."}' | lotics run query_records
|
|
107
110
|
|
|
108
111
|
# Upload files (multiple files and directories supported)
|
package/dist/cli.js
CHANGED
|
@@ -54,6 +54,8 @@ COMMANDS
|
|
|
54
54
|
lotics tools List all available tools
|
|
55
55
|
lotics tools <name> Show tool description and input schema
|
|
56
56
|
lotics run <tool> '<json>' Execute a tool
|
|
57
|
+
lotics run <tool> @args.json Read JSON args from a file (large payloads)
|
|
58
|
+
cat args.json | lotics run <tool> Read JSON args from stdin (large payloads)
|
|
57
59
|
lotics upload <file|dir...> Upload files (directories expand to their immediate files)
|
|
58
60
|
lotics download <file_id> Download a file by ID
|
|
59
61
|
lotics download record <record_id> <field_key>
|
|
@@ -533,7 +535,9 @@ async function main() {
|
|
|
533
535
|
process.exit(1);
|
|
534
536
|
}
|
|
535
537
|
if (command === "run" && !subcommand) {
|
|
536
|
-
console.error(
|
|
538
|
+
console.error("Usage: lotics run <tool> '<json_args>'\n" +
|
|
539
|
+
" lotics run <tool> @args.json (read args from a file — for large payloads)\n" +
|
|
540
|
+
" cat args.json | lotics run <tool> (read args from stdin)");
|
|
537
541
|
console.error('Run "lotics tools" to see available tools.');
|
|
538
542
|
process.exit(1);
|
|
539
543
|
}
|
|
@@ -779,7 +783,23 @@ async function main() {
|
|
|
779
783
|
if (command === "run") {
|
|
780
784
|
const toolName = subcommand;
|
|
781
785
|
let rawArgs = toolArgs;
|
|
782
|
-
if (
|
|
786
|
+
if (rawArgs && rawArgs.startsWith("@")) {
|
|
787
|
+
// `@<path>` — read the JSON args from a local file. JSON args always
|
|
788
|
+
// start with `{`, so a leading `@` is unambiguous. This (and piped
|
|
789
|
+
// stdin below) carries payloads too large for an inline arg, which the
|
|
790
|
+
// OS caps (ARG_MAX) — e.g. a knowledge doc's `content` or a bulk update.
|
|
791
|
+
// Reads only a file the caller explicitly named; no new trust boundary.
|
|
792
|
+
const argsPath = rawArgs.slice(1);
|
|
793
|
+
try {
|
|
794
|
+
rawArgs = fs.readFileSync(argsPath, "utf-8");
|
|
795
|
+
}
|
|
796
|
+
catch (err) {
|
|
797
|
+
console.error(`Cannot read args file "${argsPath}": ${err instanceof Error ? err.message : String(err)}`);
|
|
798
|
+
process.exit(1);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
else if (!rawArgs && !process.stdin.isTTY) {
|
|
802
|
+
// Piped/redirected stdin — `… | lotics run <tool>` or `< file.json`.
|
|
783
803
|
rawArgs = await readStdin();
|
|
784
804
|
}
|
|
785
805
|
let args = {};
|
package/dist/src/cli.js
CHANGED
|
@@ -47594,6 +47594,8 @@ COMMANDS
|
|
|
47594
47594
|
lotics tools List all available tools
|
|
47595
47595
|
lotics tools <name> Show tool description and input schema
|
|
47596
47596
|
lotics run <tool> '<json>' Execute a tool
|
|
47597
|
+
lotics run <tool> @args.json Read JSON args from a file (large payloads)
|
|
47598
|
+
cat args.json | lotics run <tool> Read JSON args from stdin (large payloads)
|
|
47597
47599
|
lotics upload <file|dir...> Upload files (directories expand to their immediate files)
|
|
47598
47600
|
lotics download <file_id> Download a file by ID
|
|
47599
47601
|
lotics download record <record_id> <field_key>
|
|
@@ -48038,7 +48040,9 @@ async function main() {
|
|
|
48038
48040
|
process.exit(1);
|
|
48039
48041
|
}
|
|
48040
48042
|
if (command === "run" && !subcommand) {
|
|
48041
|
-
console.error(
|
|
48043
|
+
console.error(
|
|
48044
|
+
"Usage: lotics run <tool> '<json_args>'\n lotics run <tool> @args.json (read args from a file \u2014 for large payloads)\n cat args.json | lotics run <tool> (read args from stdin)"
|
|
48045
|
+
);
|
|
48042
48046
|
console.error('Run "lotics tools" to see available tools.');
|
|
48043
48047
|
process.exit(1);
|
|
48044
48048
|
}
|
|
@@ -48270,7 +48274,17 @@ ${JSON.stringify(info.input_schema, null, 2)}`);
|
|
|
48270
48274
|
if (command === "run") {
|
|
48271
48275
|
const toolName = subcommand;
|
|
48272
48276
|
let rawArgs = toolArgs;
|
|
48273
|
-
if (
|
|
48277
|
+
if (rawArgs && rawArgs.startsWith("@")) {
|
|
48278
|
+
const argsPath = rawArgs.slice(1);
|
|
48279
|
+
try {
|
|
48280
|
+
rawArgs = fs7.readFileSync(argsPath, "utf-8");
|
|
48281
|
+
} catch (err2) {
|
|
48282
|
+
console.error(
|
|
48283
|
+
`Cannot read args file "${argsPath}": ${err2 instanceof Error ? err2.message : String(err2)}`
|
|
48284
|
+
);
|
|
48285
|
+
process.exit(1);
|
|
48286
|
+
}
|
|
48287
|
+
} else if (!rawArgs && !process.stdin.isTTY) {
|
|
48274
48288
|
rawArgs = await readStdin();
|
|
48275
48289
|
}
|
|
48276
48290
|
let args = {};
|