agent-tail-core 0.3.2 → 0.3.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/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { n as cmd_run, r as cmd_wrap, t as cmd_init } from "./commands-
|
|
2
|
+
import { n as cmd_run, r as cmd_wrap, t as cmd_init } from "./commands-B32lAAvI.mjs";
|
|
3
3
|
import { parseArgs } from "node:util";
|
|
4
4
|
|
|
5
5
|
//#region src/cli.ts
|
|
@@ -16,6 +16,7 @@ const HELP = `
|
|
|
16
16
|
--max-sessions <n> Max sessions to keep (default: 10)
|
|
17
17
|
--no-combined Don't write to combined.log
|
|
18
18
|
--exclude <pattern> Exclude lines matching pattern (repeatable, /regex or substring)
|
|
19
|
+
--mute <name> Mute a service from terminal and combined.log (repeatable, still logs to <name>.log)
|
|
19
20
|
-h, --help Show this help
|
|
20
21
|
|
|
21
22
|
\x1b[1mExamples:\x1b[0m
|
|
@@ -47,6 +48,10 @@ function parse_cli_options(args) {
|
|
|
47
48
|
type: "string",
|
|
48
49
|
multiple: true
|
|
49
50
|
},
|
|
51
|
+
mute: {
|
|
52
|
+
type: "string",
|
|
53
|
+
multiple: true
|
|
54
|
+
},
|
|
50
55
|
help: {
|
|
51
56
|
type: "boolean",
|
|
52
57
|
short: "h",
|
|
@@ -65,7 +70,8 @@ function parse_cli_options(args) {
|
|
|
65
70
|
log_dir: values["log-dir"] ?? "tmp/logs",
|
|
66
71
|
max_sessions: parseInt(values["max-sessions"] ?? "10", 10),
|
|
67
72
|
combined: !values["no-combined"],
|
|
68
|
-
excludes: values.exclude ?? []
|
|
73
|
+
excludes: values.exclude ?? [],
|
|
74
|
+
mutes: values.mute ?? []
|
|
69
75
|
},
|
|
70
76
|
positionals,
|
|
71
77
|
rest
|
|
@@ -156,7 +156,8 @@ const DEFAULT_CLI_OPTIONS = {
|
|
|
156
156
|
log_dir: "tmp/logs",
|
|
157
157
|
max_sessions: 10,
|
|
158
158
|
combined: true,
|
|
159
|
-
excludes: []
|
|
159
|
+
excludes: [],
|
|
160
|
+
mutes: []
|
|
160
161
|
};
|
|
161
162
|
function create_manager(options) {
|
|
162
163
|
return new LogManager(resolve_options({
|
|
@@ -282,6 +283,7 @@ function cmd_run(project_root, service_args, options = DEFAULT_CLI_OPTIONS) {
|
|
|
282
283
|
const tag = `${COLORS[i % COLORS.length]}[${svc.name}]${RESET}`;
|
|
283
284
|
const log_file = path.join(session_dir, `${svc.name}.log`);
|
|
284
285
|
const log_stream = fs.createWriteStream(log_file, { flags: "a" });
|
|
286
|
+
const is_muted = options.mutes.includes(svc.name);
|
|
285
287
|
const child = spawn(svc.command, {
|
|
286
288
|
stdio: [
|
|
287
289
|
"inherit",
|
|
@@ -299,12 +301,16 @@ function cmd_run(project_root, service_args, options = DEFAULT_CLI_OPTIONS) {
|
|
|
299
301
|
for (let j = 0; j < lines.length; j++) if (lines[j].length > 0) {
|
|
300
302
|
if (options.excludes.length && should_exclude(lines[j], options.excludes)) continue;
|
|
301
303
|
log_stream.write(lines[j] + "\n");
|
|
302
|
-
|
|
303
|
-
|
|
304
|
+
if (!is_muted) {
|
|
305
|
+
target.write(`${tag} ${lines[j]}\n`);
|
|
306
|
+
combined_stream?.write(`[${svc.name}] ${lines[j]}\n`);
|
|
307
|
+
}
|
|
304
308
|
} else if (j < lines.length - 1) {
|
|
305
309
|
log_stream.write("\n");
|
|
306
|
-
|
|
307
|
-
|
|
310
|
+
if (!is_muted) {
|
|
311
|
+
target.write("\n");
|
|
312
|
+
combined_stream?.write("\n");
|
|
313
|
+
}
|
|
308
314
|
}
|
|
309
315
|
}
|
|
310
316
|
child.stdout?.on("data", (chunk) => handle(process.stdout, chunk));
|
package/dist/index.d.mts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as resolve_session_dir, c as LogManager, i as parse_service_configs, l as SESSION_ENV_VAR, n as cmd_run, o as DEFAULT_OPTIONS, r as cmd_wrap, s as resolve_options, t as cmd_init, u as should_exclude } from "./commands-
|
|
1
|
+
import { a as resolve_session_dir, c as LogManager, i as parse_service_configs, l as SESSION_ENV_VAR, n as cmd_run, o as DEFAULT_OPTIONS, r as cmd_wrap, s as resolve_options, t as cmd_init, u as should_exclude } from "./commands-B32lAAvI.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/formatter.ts
|
|
4
4
|
function format_log_line(entry) {
|