agent-tail-core 0.3.2 → 0.3.4

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-BGQ-_7t4.mjs";
2
+ import { n as cmd_run, r as cmd_wrap, t as cmd_init } from "./commands-B0zBKBEa.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({
@@ -223,7 +224,10 @@ function cmd_wrap(project_root, name, command, options = DEFAULT_CLI_OPTIONS) {
223
224
  "pipe",
224
225
  "pipe"
225
226
  ],
226
- env: { ...process.env },
227
+ env: {
228
+ ...process.env,
229
+ [SESSION_ENV_VAR]: session_dir
230
+ },
227
231
  shell: true
228
232
  });
229
233
  child.stdout?.on("data", (chunk) => {
@@ -282,6 +286,7 @@ function cmd_run(project_root, service_args, options = DEFAULT_CLI_OPTIONS) {
282
286
  const tag = `${COLORS[i % COLORS.length]}[${svc.name}]${RESET}`;
283
287
  const log_file = path.join(session_dir, `${svc.name}.log`);
284
288
  const log_stream = fs.createWriteStream(log_file, { flags: "a" });
289
+ const is_muted = options.mutes.includes(svc.name);
285
290
  const child = spawn(svc.command, {
286
291
  stdio: [
287
292
  "inherit",
@@ -299,12 +304,16 @@ function cmd_run(project_root, service_args, options = DEFAULT_CLI_OPTIONS) {
299
304
  for (let j = 0; j < lines.length; j++) if (lines[j].length > 0) {
300
305
  if (options.excludes.length && should_exclude(lines[j], options.excludes)) continue;
301
306
  log_stream.write(lines[j] + "\n");
302
- target.write(`${tag} ${lines[j]}\n`);
303
- combined_stream?.write(`[${svc.name}] ${lines[j]}\n`);
307
+ if (!is_muted) {
308
+ target.write(`${tag} ${lines[j]}\n`);
309
+ combined_stream?.write(`[${svc.name}] ${lines[j]}\n`);
310
+ }
304
311
  } else if (j < lines.length - 1) {
305
312
  log_stream.write("\n");
306
- target.write("\n");
307
- combined_stream?.write("\n");
313
+ if (!is_muted) {
314
+ target.write("\n");
315
+ combined_stream?.write("\n");
316
+ }
308
317
  }
309
318
  }
310
319
  child.stdout?.on("data", (chunk) => handle(process.stdout, chunk));
package/dist/index.d.mts CHANGED
@@ -74,6 +74,7 @@ interface CliOptions {
74
74
  max_sessions: number;
75
75
  combined: boolean;
76
76
  excludes: string[];
77
+ mutes: string[];
77
78
  }
78
79
  /**
79
80
  * Create a new log session. Returns the session directory path.
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-BGQ-_7t4.mjs";
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-B0zBKBEa.mjs";
2
2
 
3
3
  //#region src/formatter.ts
4
4
  function format_log_line(entry) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "agent-tail-core",
3
3
  "type": "module",
4
- "version": "0.3.2",
4
+ "version": "0.3.4",
5
5
  "description": "Core utilities for agent-tail log capture plugins.",
6
6
  "license": "MIT",
7
7
  "repository": {