@void.01/advanced-logger 0.5.0 → 0.6.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/ARCHITECTURE.md CHANGED
@@ -28,6 +28,9 @@ src/
28
28
  ansi.ts escape-code factory, color catalog, stripAnsi
29
29
  caller.ts stack parsing: "caller" suffix and "[CHAIN]"
30
30
  sinks.ts Sink interface, built-in sinks, file writing, retention, registry
31
+ cli.ts the `advanced-logger` bin: run(args, dir, io) for init, backups, restore <n>
32
+ init.ts config template (OPTIONS, FILE_OPTIONS), adding missing options to an existing file
33
+ configBackup.ts config file backups (newest 5), restore, the "Last modified by CLI" stamp
31
34
  test/
32
35
  logger.test.ts, logger.aggressive.test.ts core behavior (vitest)
33
36
  colors.test.ts fg/bg/ansi/callerColor matrix
@@ -38,6 +41,9 @@ test/
38
41
  multi-worker.test.ts spawns real Playwright with 2 workers (fixtures/multi-worker/)
39
42
  table-files.test.ts CSV/JSON table attachments: names, contents, redaction, retention
40
43
  palette.test.ts, redaction.test.ts per-action colors; nested and free-text redaction
44
+ init.test.ts template vs real defaults, adding missing options (object, function, CRLF, JSON)
45
+ configBackup.test.ts backups kept, numbering, restore (incl. undo), stamp
46
+ cli.test.ts every command, argument checks, stdout/stderr, exit codes
41
47
  sweep/ npm run sweep: manual check of every console visual and every file, with file checks
42
48
  *.spec.ts, playwright*.config.ts, global-setup.ts Playwright e2e/demo specs
43
49
  dist/ tsc output (CommonJS, ES2022), gitignored, what npm publishes
@@ -52,6 +58,8 @@ Published entry points (`package.json` `exports`):
52
58
  | `@void.01/advanced-logger` | `dist/index.js` | `info/warn/error/debug`, `configure`, `defineConfig`, helpers |
53
59
  | `@void.01/advanced-logger/playwright` | `dist/playwright.js` | drop-in `test`/`expect` with logging fixture |
54
60
 
61
+ Command (`package.json` `bin`): `advanced-logger` → `dist/cli.js`, run as `npx @void.01/advanced-logger <init | backups | restore n>` (§19).
62
+
55
63
  ## 3. Module dependency graph
56
64
 
57
65
  ```
@@ -64,8 +72,12 @@ config ──► configFile (runtime) theme ──► config (runtime, read
64
72
  config ──► theme (type only) configFile ──► config (types only)
65
73
  sinks ──► config, theme, ansi caller ──► config (type only)
66
74
  playwright ──► config, core, sinks, logger
75
+ cli ──► init ──► configBackup, configFile (CONFIG_FILE_NAMES)
76
+ cli ──► configBackup
67
77
  ```
68
78
 
79
+ The CLI modules are not imported by `index.ts` or `playwright.ts`, so loading the logger never loads them.
80
+
69
81
  Two potential cycles are deliberately broken with `import type`: `config.ts` imports only the *type* `LevelName` from `theme.ts`, and `configFile.ts` imports only *types* from `config.ts`. `theme.ts` imports `config()` at runtime (to read `fg`/`bg`). Do not add runtime imports in the other direction.
70
82
 
71
83
  ## 4. The call path (the most important flow)
@@ -323,10 +335,12 @@ Kinds are described by `pruneSpec(kind)`: folder, the names this logger owns, th
323
335
  13. `configure()` never throws on bad input, in either form; it warns and skips (or reverts). Only a config file fails loudly.
324
336
  14. New output options that change line format default to off, so existing console and file output stays byte-identical. The one exception is masking secrets (`redactText`, on since 0.4.0): leaking a secret by default is worse than changing a line.
325
337
  15. Free-text masking runs in `dispatch` before truncation and before any sink. Do not move it into a sink, or some outputs would hold the secret.
338
+ 16. A new config option needs an entry in `init.ts` `OPTIONS` (or `FILE_OPTIONS`) with its real default; `init.test.ts` fails otherwise, and checks the written default against `resetConfig()`.
339
+ 17. The CLI only ever adds to a user's config file (plus the stamp line), and backs it up before writing. It must not reformat or remove anything, and must not run on `npm install` (no install scripts: pnpm and Yarn block them, and they would write into user repos unasked).
326
340
 
327
341
  ## 17. Differences from the Java logger
328
342
 
329
- Dropped: custom themes, `setTheme`, width/arrow settings, file rotation and gzip archives. Changed: caller frames are excluded by path rather than method-name prefix. Added: secret redaction, JSONL sink, custom sinks, in-memory capture, Playwright fixture with attachment, per-worker files, config file, `fg`/`bg`, INFO truncation, file and run retention, console worker/test prefixes, per-action colors, nested and free-text redaction.
343
+ Dropped: custom themes, `setTheme`, width/arrow settings, file rotation and gzip archives. Changed: caller frames are excluded by path rather than method-name prefix. Added: secret redaction, JSONL sink, custom sinks, in-memory capture, Playwright fixture with attachment, per-worker files, config file, `fg`/`bg`, INFO truncation, file and run retention, console worker/test prefixes, per-action colors, nested and free-text redaction, tree and table forms on every action, and the `init`/`backups`/`restore` command.
330
344
 
331
345
  ## 18. Testing map
332
346
 
@@ -335,7 +349,11 @@ Dropped: custom themes, `setTheme`, width/arrow settings, file rotation and gzip
335
349
  | Console/file output, levels, caller/chain, redaction, malformed input | `logger.test.ts`, `logger.aggressive.test.ts` |
336
350
  | fg/bg/ansi/callerColor combinations across all actions, env parsing | `colors.test.ts` |
337
351
  | Discovery order, forms, precedence, `VOID_LOG_CONFIG`, loud failures | `config-file.test.ts` |
338
- | Truncation text, WARN/DEBUG lines, hint by source | `truncate.test.ts` |
352
+ | Truncation text, WARN/DEBUG lines, hint by source, per-file notice (partial/debug) vs per-log WARN (full-trace) | `truncate.test.ts` |
353
+ | Every action's message / heading+fields (tree) / heading+rows (table) forms | `logger.test.ts` |
354
+ | `init` template (vs real defaults), adding missing options, function/JSON/CRLF configs | `init.test.ts` |
355
+ | Config backups: keep 5, numbering, restore and its undo, the "Last modified by CLI" stamp | `configBackup.test.ts` |
356
+ | The `advanced-logger` command: each command, bad arguments, stdout/stderr, exit codes | `cli.test.ts` |
339
357
  | Retention by files and runs, protection of current and recent runs, missing run id, foreign files | `retention.test.ts` |
340
358
  | consoleWorker/consoleTest prefixes, missing-run-id warning, `configure()` patch and callback validation | `separable.test.ts` |
341
359
  | Per-action colors, palette contrast and distance limits | `palette.test.ts` (+ `helpers/color-metrics.ts`) |
@@ -346,3 +364,18 @@ Dropped: custom themes, `setTheme`, width/arrow settings, file rotation and gzip
346
364
  | Visual/e2e demos | `*.spec.ts` via `test/playwright.config.ts` |
347
365
 
348
366
  Tests use `resetConfig()` plus `configure({ logDir: tmp, ansi: false, tsFormat: () => 'TS' })` for deterministic output, and spy on `process.stdout.write`. Config-file tests `chdir` into a temp dir so no stray `logger.config.*` leaks in.
367
+
368
+ ## 19. The command: init, backups, restore (`cli.ts`, `init.ts`, `configBackup.ts`)
369
+
370
+ `cli.ts` is the `bin`. `run(args, dir, io)` parses one command, writes through `io` (stdout for success, stderr for errors and bad arguments) and returns the exit code; the file only calls it when run directly (`require.main === module`), so tests import `run`. The package name in messages comes from `package.json`.
371
+
372
+ **`init`** (`init(dir, pkg)`):
373
+
374
+ - No config file in `dir` (`CONFIG_FILE_NAMES`): writes `template(pkg)`, stamped. The template is built from `OPTIONS` and `FILE_OPTIONS`: each option has `about`, `type`, `advanced`, and its default as `value` (or `raw` source text such as `[process.cwd()]`, or `detected` text for defaults worked out at runtime). `optionSection` writes the common options as `key: default,` under "---- Common options ----", then the advanced ones as `// key: default,` under "---- Advanced options ----". Each option line has a `// <about> Type: ... Default: ...` line above it.
375
+ - A `.ts`/`.js`/`.cjs` config: `addMissing(text)` works on the text, not a parse tree, so formatting and comments survive. An option counts as present when `key:` appears at a line start or after `{`/`,`, commented out or not (`mentions`). Missing top-level options go before the file's last `}` (`insertBefore`, which adds a comma after the last property when needed, skipping trailing `//` comments via `codeOf`/`lastCodeChar`); missing `files` entries go right after `files: {`. If the code before the last `}` ends in `;`, the config is a function with a block body: everything missing is added as comments above the `export default`/`module.exports` line instead (`commentedOnly`). CRLF files are processed as LF and converted back.
376
+ - A `.json` config (`initJson`): JSON has no comments, so the missing common options are added as default values (re-serialized with 2-space indent) and the advanced ones are only named in the message. Invalid JSON is refused (exit 1) and left as is.
377
+ - Before any write to an existing file: `backupConfig(file)`. After: the stamp (below).
378
+
379
+ **Backups** (`configBackup.ts`): `backupConfig` copies the file to `<dir>/.logger-config-backups/<yyyyMMdd-HHmmss-SSS>[-k]__<file name>` (`-k` when the name is taken within the same millisecond), writes a `.gitignore` (`*`) into the folder on first use, and deletes all but the newest `KEEP` (5). `listBackups` parses the names and sorts by time, then `k`, numbering 1 (oldest) to 5 (newest); other files in the folder are ignored. `restoreConfig(dir, n)` reads backup n **before** backing up the current file (that backup can push backup 1 out), then writes it back to the file name it came from.
380
+
381
+ **Stamp**: `withStamp(text, by)` puts `// Last modified by CLI: <yyyy-MM-dd HH:mm:ss> (<by>)` on the first line, replacing an earlier one. `by` is `init` or `restore of backup n, saved <time>`. JSON files get none. Hand edits do not update it.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  All notable changes to `@void.01/advanced-logger`. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project uses [Semantic Versioning](https://semver.org/). While the version is below 1.0.0, a minor release may add options but keeps existing defaults and output unchanged unless noted.
4
4
 
5
+ ## [0.6.0] - 2026-10-23
6
+
7
+ Adds the `advanced-logger` command: a config file template, config backups and restore.
8
+
9
+ ### Added
10
+
11
+ - **`npx @void.01/advanced-logger init`** writes a `logger.config.ts` with every option, each explained with its type and default: common options set to their default values, advanced ones commented out (the logger picks those, some detected at runtime), under "Common options" and "Advanced options" headings. With a config file already there, it adds only the options the file does not mention and changes nothing else. A function-style config gets them as comments; a JSON config gets the common ones as values.
12
+ - **Config backups.** Before `init` or `restore` changes a config file, it is saved to `.logger-config-backups/` (newest 5 kept, git-ignored by a `.gitignore` inside). `npx @void.01/advanced-logger backups` lists them, 1 (oldest) to 5 (newest), and `restore <n>` puts one back after backing up the current file.
13
+ - A config file changed by `init` or `restore` starts with `// Last modified by CLI: <date time> (<what>)`. JSON configs get no stamp (no comments).
14
+
5
15
  ## [0.5.0] - 2026-10-22
6
16
 
7
17
  Quieter truncation warnings in the trace files, full text in `debug-trace`, a tree or table form for every action, and shorter log file names. **Trace file names change** (`FT-...` instead of `full-trace-...`) and **`debug-trace` no longer truncates INFO logs**.
@@ -125,6 +135,7 @@ First release on npm. A self-contained TypeScript port of the VOID `core.logging
125
135
  - `initRun()` to share one run id across Playwright workers via `VOID_RUN_ID` / `VOID_RUN_DATE`.
126
136
  - Environment variables `VOID_LOG_LEVEL`, `VOID_LOG_DIR`, `VOID_LOG_ANSI`, `VOID_LOG_JSONL` and `VOID_RUN_ID`, and `configure()` for code.
127
137
 
138
+ [0.6.0]: https://www.npmjs.com/package/@void.01/advanced-logger/v/0.6.0
128
139
  [0.5.0]: https://www.npmjs.com/package/@void.01/advanced-logger/v/0.5.0
129
140
  [0.4.1]: https://www.npmjs.com/package/@void.01/advanced-logger/v/0.4.1
130
141
  [0.4.0]: https://www.npmjs.com/package/@aryan-vashishth/advanced-logger/v/0.4.0
package/README.md CHANGED
@@ -15,7 +15,7 @@ npm install @void.01/advanced-logger
15
15
  Pin an exact version if you want reproducible installs:
16
16
 
17
17
  ```bash
18
- npm install @void.01/advanced-logger@0.4.0
18
+ npm install @void.01/advanced-logger@0.6.0
19
19
  ```
20
20
 
21
21
  Requirements:
@@ -25,6 +25,44 @@ Requirements:
25
25
 
26
26
  Check the installed version with `npm ls @void.01/advanced-logger`, and update with `npm update @void.01/advanced-logger`.
27
27
 
28
+ ### CLI cheat sheet
29
+
30
+ Run these in the folder that holds (or should hold) `logger.config.*`, usually the project root.
31
+
32
+ | I want to... | Run | What happens |
33
+ |---|---|---|
34
+ | Start a config file | `npx @void.01/advanced-logger init` | Creates `logger.config.ts`: common options at their defaults, advanced ones commented out |
35
+ | Add options my config is missing (e.g. after upgrading) | `npx @void.01/advanced-logger init` | Backs the file up, then adds only what it does not mention. Prints the restore number |
36
+ | See my config backups | `npx @void.01/advanced-logger backups` | Lists them, `1` (oldest) to `5` (newest), with times |
37
+ | Undo the last `init` | `npx @void.01/advanced-logger restore <newest>` | Puts that version back (the number `init` printed, or the last one in `backups`) |
38
+ | Go back to an older config | `npx @void.01/advanced-logger restore 2` | Backs up the current file, then restores backup 2 |
39
+ | Undo a restore | `npx @void.01/advanced-logger restore 5` | The file a restore replaced is always the newest backup |
40
+ | See the commands | `npx @void.01/advanced-logger --help` | Prints usage |
41
+
42
+ - Exit code `0` on success, `1` on a bad command or number, a missing backup, or an invalid JSON config. Errors go to stderr.
43
+ - Backups live in `.logger-config-backups/` next to the config (git-ignored, newest 5 kept).
44
+ - Nothing runs on `npm install`; these only run when you call them.
45
+
46
+ ### Config file template and backups
47
+
48
+ `init`, with no config file in the current folder, creates `logger.config.ts` with every option in two labelled sections:
49
+
50
+ - **Common options** (`level`, `console`, `consoleWorker`, `consoleTest`, `infoLogsCharLimit`, `logDir`, `files`, `maxLogFiles`, `maxRuns`, `redactKeys`, `attach`), set to their default values, ready to change.
51
+ - **Advanced options** (colors, timestamp format, stack filtering, `projectRoots`, ...), commented out as `// key: default,`. Left commented, the logger picks the default, including the ones it detects at runtime (`ansi`, `githubAnnotations`). Uncomment one to change it.
52
+
53
+ Each option has a comment above it saying what it does, its type and its default.
54
+
55
+ With a config file already there, `init` adds only the options it does not mention (a commented-out option counts as mentioned), in the same two sections, and changes nothing else. Run it again after upgrading to pick up new options.
56
+
57
+ - A config written as a function with a `return` statement gets the missing options as comments above the export, since there is no object to put values in.
58
+ - A `logger.config.json` gets the common options as default values. JSON has no comments, so the advanced ones are only listed; left out, they use their defaults.
59
+
60
+ **Backups.** Before `init` or `restore` changes a config file, the current version is saved in `.logger-config-backups/` next to it, and the newest 5 are kept. The folder holds its own `.gitignore`, so backups are never committed. `restore <n>` backs up the current file first, so a restore can be undone with `restore 5`.
61
+
62
+ **Stamp.** A `.ts` or `.js` config file that `init` or `restore` changed starts with `// Last modified by CLI: <date time> (init)` (or `(restore of backup 3, saved <date time>)`). Edits you make by hand do not update it.
63
+
64
+ These commands run only when you call them, not on `npm install`. Install scripts are blocked by default in pnpm and Yarn and with `--ignore-scripts`, so a template written on install would appear for some users and not others.
65
+
28
66
  ### Entry points
29
67
 
30
68
  | Import | Use |
package/dist/cli.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ export declare const PKG: string;
3
+ export declare const USAGE: string;
4
+ export interface Io {
5
+ out(text: string): void;
6
+ err(text: string): void;
7
+ }
8
+ /** Runs one CLI command in `dir`. Returns the exit code. */
9
+ export declare function run(args: string[], dir: string, io: Io): number;
10
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAKA,eAAO,MAAM,GAAG,QAAwD,CAAC;AAEzE,eAAO,MAAM,KAAK,QAM4E,CAAC;AAE/F,MAAM,WAAW,EAAE;IACjB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,4DAA4D;AAC5D,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,GAAG,MAAM,CAoB/D"}
package/dist/cli.js ADDED
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.USAGE = exports.PKG = void 0;
5
+ exports.run = run;
6
+ const configBackup_1 = require("./configBackup");
7
+ const init_1 = require("./init");
8
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
9
+ exports.PKG = require('../package.json').name;
10
+ exports.USAGE = `Usage: npx ${exports.PKG} <command>
11
+
12
+ init Create logger.config.ts in the current folder: common options set to their
13
+ defaults, advanced ones commented out. If a config file already exists, add
14
+ only the options it does not mention yet, after backing it up.
15
+ backups List the config backups, 1 (oldest) to ${configBackup_1.KEEP} (newest).
16
+ restore <n> Put backup n back. The current file is backed up first, so this can be undone.`;
17
+ /** Runs one CLI command in `dir`. Returns the exit code. */
18
+ function run(args, dir, io) {
19
+ const [command, ...rest] = args;
20
+ const done = (ok, message) => {
21
+ (ok ? io.out : io.err)(message + '\n');
22
+ return ok ? 0 : 1;
23
+ };
24
+ if (command === 'init' && rest.length === 0) {
25
+ const outcome = (0, init_1.init)(dir, exports.PKG);
26
+ const code = done(outcome.action !== 'refused', outcome.message);
27
+ if (outcome.action === 'created')
28
+ io.out('Next: call initRun() from your Playwright globalSetup, so all workers share one run id.\n');
29
+ return code;
30
+ }
31
+ if (command === 'backups' && rest.length === 0)
32
+ return done(true, (0, configBackup_1.formatBackups)(dir));
33
+ if (command === 'restore' && rest.length === 1 && /^\d+$/.test(rest[0])) {
34
+ const r = (0, configBackup_1.restoreConfig)(dir, Number(rest[0]));
35
+ return done(r.ok, r.message);
36
+ }
37
+ const help = command === undefined || command === '--help' || command === '-h';
38
+ return done(help, (help ? '' : `Unknown command: ${args.join(' ')}\n\n`) + exports.USAGE);
39
+ }
40
+ if (require.main === module) {
41
+ process.exitCode = run(process.argv.slice(2), process.cwd(), {
42
+ out: (t) => process.stdout.write(t),
43
+ err: (t) => process.stderr.write(t),
44
+ });
45
+ }
46
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;AAqBA,kBAoBC;AAxCD,iDAAoE;AACpE,iCAA8B;AAE9B,iEAAiE;AACpD,QAAA,GAAG,GAAI,OAAO,CAAC,iBAAiB,CAAsB,CAAC,IAAI,CAAC;AAE5D,QAAA,KAAK,GAAG,cAAc,WAAG;;;;;wDAKkB,mBAAI;8FACkC,CAAC;AAO/F,4DAA4D;AAC5D,SAAgB,GAAG,CAAC,IAAc,EAAE,GAAW,EAAE,EAAM;IACrD,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAChC,MAAM,IAAI,GAAG,CAAC,EAAW,EAAE,OAAe,EAAU,EAAE;QACpD,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;QACvC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC,CAAC;IAEF,IAAI,OAAO,KAAK,MAAM,IAAI,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,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE;QAC3D,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACnC,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;KACpC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Config file backups for the CLI: `init` saves the file before changing it, `restore <n>` puts one back (saving
3
+ * the current file first, so a restore can be undone too). The newest KEEP are kept, in BACKUP_DIR next to the
4
+ * config, named `<yyyyMMdd-HHmmss-SSS>[-<k>]__<config file name>` so they sort by time and say what they restore.
5
+ */
6
+ export declare const BACKUP_DIR = ".logger-config-backups";
7
+ export declare const KEEP = 5;
8
+ export interface Backup {
9
+ /** 1 is the oldest, KEEP the newest. */
10
+ n: number;
11
+ file: string;
12
+ /** The config file it restores (`logger.config.ts`). */
13
+ target: string;
14
+ time: Date;
15
+ }
16
+ /** Oldest first, numbered from 1. Files in the folder that are not backups are ignored. */
17
+ export declare function listBackups(dir: string): Backup[];
18
+ /** Copies `configFile` into the backup folder, then drops the oldest beyond KEEP. Returns the backup's path. */
19
+ export declare function backupConfig(configFile: string): string;
20
+ export interface RestoreOutcome {
21
+ ok: boolean;
22
+ message: string;
23
+ }
24
+ /**
25
+ * Puts backup `n` (as numbered by listBackups before this call) back in place. The current file is backed up first,
26
+ * which may drop the oldest backup, so backup n is read before that.
27
+ */
28
+ export declare function restoreConfig(dir: string, n: number): RestoreOutcome;
29
+ /**
30
+ * The text with its first line saying when the CLI last changed it and how (`by`: "init", "restore of backup 2, ..."),
31
+ * replacing an earlier such line. Not for JSON, which has no comments. Edits made by hand do not update it, which
32
+ * is why the line says "by CLI".
33
+ */
34
+ export declare function withStamp(text: string, by: string, now?: Date): string;
35
+ export declare const describeTime: (d: Date) => string;
36
+ /** The numbered list the `backups` command prints. */
37
+ export declare function formatBackups(dir: string): string;
38
+ //# sourceMappingURL=configBackup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configBackup.d.ts","sourceRoot":"","sources":["../src/configBackup.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,eAAO,MAAM,UAAU,2BAA2B,CAAC;AACnD,eAAO,MAAM,IAAI,IAAI,CAAC;AAEtB,MAAM,WAAW,MAAM;IACrB,wCAAwC;IACxC,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,IAAI,CAAC;CACZ;AAQD,2FAA2F;AAC3F,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAiBjD;AAED,gHAAgH;AAChH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAiBvD;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,OAAO,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,cAAc,CAkBpE;AAID;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,OAAa,GAAG,MAAM,CAI5E;AAED,eAAO,MAAM,YAAY,GAAI,GAAG,IAAI,KAAG,MAC+F,CAAC;AAEvI,sDAAsD;AACtD,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAMjD"}
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.describeTime = exports.KEEP = exports.BACKUP_DIR = void 0;
37
+ exports.listBackups = listBackups;
38
+ exports.backupConfig = backupConfig;
39
+ exports.restoreConfig = restoreConfig;
40
+ exports.withStamp = withStamp;
41
+ exports.formatBackups = formatBackups;
42
+ const fs = __importStar(require("node:fs"));
43
+ const path = __importStar(require("node:path"));
44
+ /**
45
+ * Config file backups for the CLI: `init` saves the file before changing it, `restore <n>` puts one back (saving
46
+ * the current file first, so a restore can be undone too). The newest KEEP are kept, in BACKUP_DIR next to the
47
+ * config, named `<yyyyMMdd-HHmmss-SSS>[-<k>]__<config file name>` so they sort by time and say what they restore.
48
+ */
49
+ exports.BACKUP_DIR = '.logger-config-backups';
50
+ exports.KEEP = 5;
51
+ const NAME = /^(\d{4})(\d{2})(\d{2})-(\d{2})(\d{2})(\d{2})-(\d{3})(?:-(\d+))?__(.+)$/;
52
+ const pad = (v, w = 2) => String(v).padStart(w, '0');
53
+ const stampOf = (d) => `${d.getFullYear()}${pad(d.getMonth() + 1)}${pad(d.getDate())}-${pad(d.getHours())}${pad(d.getMinutes())}${pad(d.getSeconds())}-${pad(d.getMilliseconds(), 3)}`;
54
+ /** Oldest first, numbered from 1. Files in the folder that are not backups are ignored. */
55
+ function listBackups(dir) {
56
+ const folder = path.join(dir, exports.BACKUP_DIR);
57
+ let names;
58
+ try {
59
+ names = fs.readdirSync(folder);
60
+ }
61
+ catch {
62
+ return [];
63
+ }
64
+ return names
65
+ .map((name) => ({ name, m: NAME.exec(name) }))
66
+ .filter((x) => x.m !== null)
67
+ .map(({ name, m }) => {
68
+ const [y, mo, d, h, mi, s, ms] = m.slice(1, 8).map(Number);
69
+ return { file: path.join(folder, name), target: m[9], time: new Date(y, mo - 1, d, h, mi, s, ms), seq: Number(m[8] ?? 0) };
70
+ })
71
+ .sort((a, b) => a.time.getTime() - b.time.getTime() || a.seq - b.seq)
72
+ .map(({ seq: _seq, ...b }, i) => ({ ...b, n: i + 1 }));
73
+ }
74
+ /** Copies `configFile` into the backup folder, then drops the oldest beyond KEEP. Returns the backup's path. */
75
+ function backupConfig(configFile) {
76
+ const dir = path.dirname(configFile);
77
+ const folder = path.join(dir, exports.BACKUP_DIR);
78
+ fs.mkdirSync(folder, { recursive: true });
79
+ // The folder ignores itself, so backups never end up in a commit and the user's .gitignore is not touched.
80
+ const ignore = path.join(folder, '.gitignore');
81
+ if (!fs.existsSync(ignore))
82
+ fs.writeFileSync(ignore, '# Created by advanced-logger: config file backups, not for commits.\n*\n');
83
+ const stamp = stampOf(new Date());
84
+ const base = path.basename(configFile);
85
+ let file = path.join(folder, `${stamp}__${base}`);
86
+ for (let k = 1; fs.existsSync(file); k++)
87
+ file = path.join(folder, `${stamp}-${k}__${base}`);
88
+ fs.copyFileSync(configFile, file);
89
+ const all = listBackups(dir);
90
+ for (const old of all.slice(0, Math.max(0, all.length - exports.KEEP)))
91
+ fs.rmSync(old.file, { force: true });
92
+ return file;
93
+ }
94
+ /**
95
+ * Puts backup `n` (as numbered by listBackups before this call) back in place. The current file is backed up first,
96
+ * which may drop the oldest backup, so backup n is read before that.
97
+ */
98
+ function restoreConfig(dir, n) {
99
+ const all = listBackups(dir);
100
+ if (all.length === 0)
101
+ return { ok: false, message: `No backups in ${path.join(dir, exports.BACKUP_DIR)}. init makes one each time it changes the config file.` };
102
+ const chosen = all.find((b) => b.n === n);
103
+ if (!Number.isInteger(n) || !chosen) {
104
+ return { ok: false, message: `There is no backup ${n}. Choose 1 (oldest) to ${all.length} (newest); run "backups" to see them.` };
105
+ }
106
+ const content = fs.readFileSync(chosen.file, 'utf8');
107
+ const target = path.join(dir, chosen.target);
108
+ const saved = fs.existsSync(target) ? backupConfig(target) : undefined;
109
+ const stamped = target.endsWith('.json') ? content : withStamp(content, `restore of backup ${n}, saved ${(0, exports.describeTime)(chosen.time)}`);
110
+ fs.writeFileSync(target, stamped);
111
+ return {
112
+ ok: true,
113
+ message: `Restored ${chosen.target} from backup ${n} (${(0, exports.describeTime)(chosen.time)}).` +
114
+ (saved ? ` The version it replaced is now the newest backup (${exports.KEEP} are kept).` : ''),
115
+ };
116
+ }
117
+ const STAMP = /^\/\/ Last modified by CLI: .*$/m;
118
+ /**
119
+ * The text with its first line saying when the CLI last changed it and how (`by`: "init", "restore of backup 2, ..."),
120
+ * replacing an earlier such line. Not for JSON, which has no comments. Edits made by hand do not update it, which
121
+ * is why the line says "by CLI".
122
+ */
123
+ function withStamp(text, by, now = new Date()) {
124
+ const eol = text.includes('\r\n') ? '\r\n' : '\n';
125
+ const line = `// Last modified by CLI: ${(0, exports.describeTime)(now)} (${by})`;
126
+ return STAMP.test(text) ? text.replace(STAMP, line) : line + eol + text;
127
+ }
128
+ const describeTime = (d) => `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;
129
+ exports.describeTime = describeTime;
130
+ /** The numbered list the `backups` command prints. */
131
+ function formatBackups(dir) {
132
+ const all = listBackups(dir);
133
+ if (all.length === 0)
134
+ return `No backups in ${path.join(dir, exports.BACKUP_DIR)}.`;
135
+ return all
136
+ .map((b) => ` ${b.n} ${(0, exports.describeTime)(b.time)} ${b.target}${b.n === 1 ? ' (oldest)' : ''}${b.n === all.length && all.length > 1 ? ' (newest)' : ''}`)
137
+ .join('\n');
138
+ }
139
+ //# sourceMappingURL=configBackup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configBackup.js","sourceRoot":"","sources":["../src/configBackup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,kCAiBC;AAGD,oCAiBC;AAWD,sCAkBC;AASD,8BAIC;AAMD,sCAMC;AAtHD,4CAA8B;AAC9B,gDAAkC;AAElC;;;;GAIG;AACU,QAAA,UAAU,GAAG,wBAAwB,CAAC;AACtC,QAAA,IAAI,GAAG,CAAC,CAAC;AAWtB,MAAM,IAAI,GAAG,wEAAwE,CAAC;AAEtF,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,CAAC,GAAG,CAAC,EAAU,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACrE,MAAM,OAAO,GAAG,CAAC,CAAO,EAAU,EAAE,CAClC,GAAG,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,eAAe,EAAE,E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AAG,CAAC,CAAC,WAAW,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;AAD1H,QAAA,YAAY,gBAC8G;AAEvI,sDAAsD;AACtD,SAAgB,aAAa,CAAC,GAAW;IACvC,MAAM,GAAG,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IAC7B,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,iBAAiB,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,kBAAU,CAAC,GAAG,CAAC;IAC5E,OAAO,GAAG;SACP,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,IAAA,oBAAY,EAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;SACvJ,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
@@ -13,6 +13,10 @@ export declare function loadConfigFile(env: NodeJS.ProcessEnv, cwd: string): Loa
13
13
  export declare const loadedConfigFile: () => string | undefined;
14
14
  /** Drop the cached module so the next load re-reads the file (tests, resetConfig). */
15
15
  export declare function forgetConfigFile(): void;
16
+ /** Every config option: its check and how to describe a valid value. init.ts lists the same options (a test keeps them in step). */
17
+ export declare const KEYS: Record<keyof LogConfigPatch, [check: (v: unknown) => boolean, expected: string]>;
18
+ /** The entries `files` may have. */
19
+ export declare const FILE_KEYS: string[];
16
20
  /**
17
21
  * Check a patch against KEYS. Every unknown key or wrong-typed value becomes a message naming `where`, and is left
18
22
  * out of the returned patch; undefined values are dropped. Shared by config files (which throw on the first problem)
@@ -1 +1 @@
1
- {"version":3,"file":"configFile.d.ts","sourceRoot":"","sources":["../src/configFile.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1D,mFAAmF;AACnF,eAAO,MAAM,iBAAiB,8FAA+F,CAAC;AAE9H,KAAK,MAAM,GAAG,cAAc,GAAG,CAAC,CAAC,MAAM,EAAE,SAAS,KAAK,cAAc,CAAC,CAAC;AAEvE,8GAA8G;AAC9G,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAczF;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CA4BtF;AAID,uEAAuE;AACvE,eAAO,MAAM,gBAAgB,QAAO,MAAM,GAAG,SAAmB,CAAC;AAEjE,sFAAsF;AACtF,wBAAgB,gBAAgB,IAAI,IAAI,CASvC;AA0DD;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,yEAAyE;IACzE,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,cAAc,CAAC;IAAC,QAAQ,EAAE,YAAY,EAAE,CAAA;CAAE,CA8B7H"}
1
+ {"version":3,"file":"configFile.d.ts","sourceRoot":"","sources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object.defineProperty(exports, "__esModule", { value: true });
36
- exports.loadedConfigFile = exports.CONFIG_FILE_NAMES = void 0;
36
+ exports.FILE_KEYS = exports.KEYS = exports.loadedConfigFile = exports.CONFIG_FILE_NAMES = void 0;
37
37
  exports.resolveConfigFile = resolveConfigFile;
38
38
  exports.loadConfigFile = loadConfigFile;
39
39
  exports.forgetConfigFile = forgetConfigFile;
@@ -127,7 +127,8 @@ const str = (v) => typeof v === 'string';
127
127
  const strList = (v) => (Array.isArray(v) || v instanceof Set) && [...v].every((x) => typeof x === 'string');
128
128
  const strArr = (v) => Array.isArray(v) && v.every((x) => typeof x === 'string');
129
129
  const oneOf = (...allowed) => (v) => typeof v === 'string' && allowed.includes(v);
130
- const KEYS = {
130
+ /** Every config option: its check and how to describe a valid value. init.ts lists the same options (a test keeps them in step). */
131
+ exports.KEYS = {
131
132
  level: [oneOf('debug', 'info', 'warn', 'error', 'off'), "one of 'debug' | 'info' | 'warn' | 'error' | 'off'"],
132
133
  ansi: [bool, 'a boolean'],
133
134
  fg: [bool, 'a boolean'],
@@ -155,16 +156,17 @@ const KEYS = {
155
156
  redactKeys: [strArr, 'an array of strings'],
156
157
  attach: [oneOf('on-failure', 'always', 'never'), "one of 'on-failure' | 'always' | 'never'"],
157
158
  };
158
- const FILE_KEYS = ['debugTrace', 'partialTrace', 'fullTrace', 'jsonl', 'tables'];
159
+ /** The entries `files` may have. */
160
+ exports.FILE_KEYS = ['debugTrace', 'partialTrace', 'fullTrace', 'jsonl', 'tables'];
159
161
  function checkPatch(value, where) {
160
162
  const out = {};
161
163
  const problems = [];
162
164
  for (const [key, v] of Object.entries(value)) {
163
165
  if (v === undefined)
164
166
  continue;
165
- const rule = KEYS[key];
167
+ const rule = exports.KEYS[key];
166
168
  if (!rule) {
167
- problems.push({ key, message: `[advanced-logger] ${where} has an unknown option '${key}'. Valid options: ${Object.keys(KEYS).join(', ')}.` });
169
+ problems.push({ key, message: `[advanced-logger] ${where} has an unknown option '${key}'. Valid options: ${Object.keys(exports.KEYS).join(', ')}.` });
168
170
  continue;
169
171
  }
170
172
  if (!rule[0](v)) {
@@ -176,8 +178,8 @@ function checkPatch(value, where) {
176
178
  for (const [fk, fv] of Object.entries(v)) {
177
179
  if (fv === undefined)
178
180
  continue;
179
- if (!FILE_KEYS.includes(fk) || typeof fv !== 'boolean') {
180
- problems.push({ key: `files.${fk}`, message: `[advanced-logger] ${where}: option 'files.${fk}' must be a boolean and one of ${FILE_KEYS.join(', ')}.` });
181
+ if (!exports.FILE_KEYS.includes(fk) || typeof fv !== 'boolean') {
182
+ problems.push({ key: `files.${fk}`, message: `[advanced-logger] ${where}: option 'files.${fk}' must be a boolean and one of ${exports.FILE_KEYS.join(', ')}.` });
181
183
  continue;
182
184
  }
183
185
  files[fk] = fv;
@@ -1 +1 @@
1
- {"version":3,"file":"configFile.js","sourceRoot":"","sources":["../src/configFile.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,8CAcC;AAMD,wCA4BC;AAQD,4CASC;AAqED,gCA8BC;AA9KD,4CAA8B;AAC9B,gDAAkC;AAGlC,mFAAmF;AACtE,QAAA,iBAAiB,GAAG,CAAC,kBAAkB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,oBAAoB,CAAU,CAAC;AAI9H,8GAA8G;AAC9G,SAAgB,iBAAiB,CAAC,GAAsB,EAAE,GAAW;IACnE,MAAM,QAAQ,GAAG,GAAG,CAAC,eAAe,CAAC;IACrC,IAAI,QAAQ,EAAE,CAAC;QACb,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACzC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,2EAA2E,IAAI,EAAE,CAAC,CAAC;QACrG,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,yBA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K,EAAE,eAAe,IAAI,EAAE,CAAC,CAAC;IACrE,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAE,CAAC,OAAO,CAAC,CAAC;IAC/D,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,QAAQ,CAAC,CAAU;IAC1B,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IAC9B,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAAE,OAAO,UAAU,CAAC;IACxC,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,UAAU,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IAChE,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1E,CAAC"}
package/dist/init.d.ts ADDED
@@ -0,0 +1,54 @@
1
+ /**
2
+ * `npx @void.01/advanced-logger init`: writes a logger.config.ts with the common options set to their defaults and
3
+ * the advanced ones commented out (so the logger picks them, some detected at runtime), or adds the options an
4
+ * existing config file does not mention yet. Text-based, so the user's formatting and comments are kept; nothing
5
+ * already in the file is changed.
6
+ */
7
+ interface Option {
8
+ key: string;
9
+ /** Allowed values, shown above the key with the default. */
10
+ type: string;
11
+ about: string;
12
+ /** Commented out in the template: left that way, the logger picks the default. */
13
+ advanced: boolean;
14
+ /** The default, written as the value. */
15
+ value?: unknown;
16
+ /** Source text for a default that is not a plain value (`[process.cwd()]`). */
17
+ raw?: string;
18
+ /** Said instead of the value when the default is worked out at runtime. */
19
+ detected?: string;
20
+ }
21
+ /**
22
+ * Every top-level option, common ones first, in template order. test/init.test.ts checks the keys against
23
+ * configFile's KEYS and the values against the built-in defaults.
24
+ */
25
+ export declare const OPTIONS: Option[];
26
+ /** Entries of `files`, in template order. Always written as values: they are common, and none is detected. */
27
+ export declare const FILE_OPTIONS: Option[];
28
+ /** A new logger.config.ts importing defineConfig from `pkg`, without the stamp line (init adds it). */
29
+ export declare function template(pkg: string): string;
30
+ export interface MergeResult {
31
+ text: string;
32
+ added: string[];
33
+ /** True when the config is a function with a body: everything was added as comments above it. */
34
+ commentedOnly: boolean;
35
+ }
36
+ /** Works on \n text and gives the file's own line ends back (Windows files stay CRLF). */
37
+ export declare function addMissing(source: string): MergeResult;
38
+ /** What init did, for the CLI to print. */
39
+ export interface InitOutcome {
40
+ /** The config file created, updated or looked at. */
41
+ file: string;
42
+ /** 'refused': the file could not be read as a config (invalid JSON) and was left as is; the CLI exits 1. */
43
+ action: 'created' | 'updated' | 'unchanged' | 'refused';
44
+ /** Options added, `files.<entry>` for an entry of `files`. */
45
+ added: string[];
46
+ message: string;
47
+ }
48
+ /**
49
+ * Creates `dir`/logger.config.ts from the template, stamped, or adds the missing options to the first existing
50
+ * config file (CONFIG_FILE_NAMES order), backing it up first. Never removes or rewrites what the file has.
51
+ */
52
+ export declare function init(dir: string, pkg: string): InitOutcome;
53
+ export {};
54
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AAEH,UAAU,MAAM;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,kFAAkF;IAClF,QAAQ,EAAE,OAAO,CAAC;IAClB,yCAAyC;IACzC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,+EAA+E;IAC/E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,MAAM,EA4B3B,CAAC;AAEF,8GAA8G;AAC9G,eAAO,MAAM,YAAY,EAAE,MAAM,EAMhC,CAAC;AAwCF,uGAAuG;AACvG,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAU5C;AAmDD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,iGAAiG;IACjG,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,0FAA0F;AAC1F,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAItD;AA4CD,2CAA2C;AAC3C,MAAM,WAAW,WAAW;IAC1B,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,4GAA4G;IAC5G,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC;IACxD,8DAA8D;IAC9D,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAsCD;;;GAGG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,WAAW,CAsB1D"}
package/dist/init.js ADDED
@@ -0,0 +1,289 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.FILE_OPTIONS = exports.OPTIONS = void 0;
37
+ exports.template = template;
38
+ exports.addMissing = addMissing;
39
+ exports.init = init;
40
+ const fs = __importStar(require("node:fs"));
41
+ const path = __importStar(require("node:path"));
42
+ const configBackup_1 = require("./configBackup");
43
+ const configFile_1 = require("./configFile");
44
+ /**
45
+ * Every top-level option, common ones first, in template order. test/init.test.ts checks the keys against
46
+ * configFile's KEYS and the values against the built-in defaults.
47
+ */
48
+ exports.OPTIONS = [
49
+ { key: 'level', type: "'debug' | 'info' | 'warn' | 'error' | 'off'", value: 'info', advanced: false, about: 'Console, partial-trace and the report attachment show this level and above. debug-trace and full-trace always record every level.' },
50
+ { key: 'console', type: 'boolean', value: true, advanced: false, about: 'Print log lines to the console.' },
51
+ { key: 'consoleWorker', type: 'boolean', value: false, advanced: false, about: 'Prefix console lines with the worker (w0, w1, ...).' },
52
+ { key: 'consoleTest', type: 'boolean', value: false, advanced: false, about: "Prefix console lines with the running test's title (max 40 chars)." },
53
+ { key: 'infoLogsCharLimit', type: 'number, or null for no limit', value: null, advanced: false, about: 'INFO logs longer than this are cut on the console and in partial-trace; debug-trace keeps the full text.' },
54
+ { key: 'logDir', type: 'string', value: './logs', advanced: false, about: 'Folder for trace files and table attachments.' },
55
+ { key: 'files', type: 'booleans', advanced: false, about: 'Which files to write.' },
56
+ { key: 'maxLogFiles', type: 'integer, or null to keep all', value: null, advanced: false, about: 'Keep the newest N trace files per kind.' },
57
+ { key: 'maxRuns', type: 'integer, or null to keep all', value: null, advanced: false, about: 'Keep the files of the newest N runs.' },
58
+ { key: 'redactKeys', type: 'string[]', value: ['password', 'passwd', 'secret', 'token', 'authorization', 'apikey', 'api_key'], advanced: false, about: 'Field keys whose values print as ***. Setting this replaces the defaults.' },
59
+ { key: 'attach', type: "'on-failure' | 'always' | 'never'", value: 'on-failure', advanced: false, about: "When the Playwright fixture attaches the test's log to the report." },
60
+ { key: 'ansi', type: 'boolean', value: true, detected: 'detected from NO_COLOR, FORCE_COLOR, the terminal and CI', advanced: true, about: 'Colors on or off. Off overrides fg and bg.' },
61
+ { key: 'fg', type: 'boolean', value: true, advanced: true, about: 'Per-action text colors (needs ansi).' },
62
+ { key: 'bg', type: 'boolean', value: true, advanced: true, about: 'Theme background color (needs ansi).' },
63
+ { key: 'callerColor', type: 'boolean', value: false, advanced: true, about: 'Color the caller suffix separately on the console.' },
64
+ { key: 'tsFormat', type: 'pattern string, or (date) => string', value: 'yyyy-MM-dd HH:mm:ss.SSS', advanced: true, about: 'Timestamp format.' },
65
+ { key: 'segmentDivider', type: 'string', value: ' │ ', advanced: true, about: 'Separator between the parts of a line.' },
66
+ { key: 'tableCellLimit', type: 'number', value: 40, advanced: true, about: 'Max characters per table cell, when tableCellLimitEnabled is true.' },
67
+ { key: 'tableCellLimitEnabled', type: 'boolean', value: false, advanced: true, about: 'Cut table cells at tableCellLimit.' },
68
+ { key: 'recentRunMinutes', type: 'number', value: 60, advanced: true, about: 'Never delete a run with a file changed in the last N minutes.' },
69
+ { key: 'redactText', type: 'boolean', value: true, advanced: true, about: 'Mask key=value secrets inside message text.' },
70
+ { key: 'suppressContains', type: 'string[]', value: ['node_modules', 'node:', '<anonymous>'], advanced: true, about: 'Stack frames containing any of these are left out of the caller and [CHAIN].' },
71
+ { key: 'suppressMethodPrefixes', type: 'string[]', value: [], advanced: true, about: 'Stack frames whose method starts with any of these are left out.' },
72
+ { key: 'includeOnlyPrefixes', type: 'string[], empty to keep all', value: [], advanced: true, about: 'When set, only frames from these paths or classes are kept.' },
73
+ { key: 'projectRoots', type: 'string[]', raw: '[process.cwd()]', advanced: true, about: 'Frames under these folders form the [CHAIN] in full-trace.' },
74
+ { key: 'githubAnnotations', type: 'boolean', value: false, detected: 'true under GitHub Actions, else false', advanced: true, about: 'Also print ::error:: / ::warning:: lines for GitHub.' },
75
+ ];
76
+ /** Entries of `files`, in template order. Always written as values: they are common, and none is detected. */
77
+ exports.FILE_OPTIONS = [
78
+ { key: 'debugTrace', type: 'boolean', value: true, advanced: false, about: 'Every level, with the caller.' },
79
+ { key: 'partialTrace', type: 'boolean', value: true, advanced: false, about: 'The lines visible at `level`.' },
80
+ { key: 'fullTrace', type: 'boolean', value: true, advanced: false, about: 'Every level, with the [CHAIN].' },
81
+ { key: 'jsonl', type: 'boolean', value: false, advanced: false, about: 'One JSON record per log call.' },
82
+ { key: 'tables', type: 'boolean', value: true, advanced: false, about: 'A CSV and a JSON file for every logged table.' },
83
+ ];
84
+ /** A value as TypeScript/JavaScript source, single-quoted. */
85
+ function literal(v) {
86
+ if (typeof v === 'string')
87
+ return `'${v.replace(/\\/g, '\\\\').replace(/'/g, "\\'")}'`;
88
+ if (Array.isArray(v))
89
+ return `[${v.map(literal).join(', ')}]`;
90
+ if (v !== null && typeof v === 'object')
91
+ return `{ ${Object.entries(v).map(([k, x]) => `${k}: ${literal(x)}`).join(', ')} }`;
92
+ return String(v);
93
+ }
94
+ const FILES_DEFAULT = Object.fromEntries(exports.FILE_OPTIONS.map((o) => [o.key, o.value]));
95
+ const sourceOf = (o) => o.raw ?? literal(o.key === 'files' ? FILES_DEFAULT : o.value);
96
+ const describe = (o) => `// ${o.about} Type: ${o.type}. Default: ${o.detected ?? sourceOf(o)}.`;
97
+ /** The option's comment and its line; `commented` writes `// key: default,`, which the logger ignores. */
98
+ function optionLines(o, indent, commented = o.advanced) {
99
+ if (o.key === 'files' && !commented) {
100
+ const inner = indent + ' ';
101
+ return [`${indent}${describe(o)}`, `${indent}files: {`, ...exports.FILE_OPTIONS.flatMap((f) => optionLines(f, inner)), `${indent}},`];
102
+ }
103
+ return [`${indent}${describe(o)}`, `${indent}${commented ? '// ' : ''}${o.key}: ${sourceOf(o)},`];
104
+ }
105
+ const COMMON_HEADER = ['// ---- Common options ----', '// Set to their defaults. Change any value.'];
106
+ const ADVANCED_HEADER = [
107
+ '// ---- Advanced options ----',
108
+ '// Commented out, so the logger picks the default (some are detected at runtime). Uncomment one to change it.',
109
+ ];
110
+ /** Common options under their header, then the advanced ones under theirs. `commented` comments out every line. */
111
+ function optionSection(options, indent, commented) {
112
+ const common = options.filter((o) => !o.advanced);
113
+ const advanced = options.filter((o) => o.advanced);
114
+ const section = (header, list) => list.length === 0 ? [] : [...header.map((h) => indent + h), ...list.flatMap((o) => optionLines(o, indent, commented))];
115
+ const first = section(COMMON_HEADER, common);
116
+ const second = section(ADVANCED_HEADER, advanced);
117
+ return [...first, ...(first.length && second.length ? [''] : []), ...second];
118
+ }
119
+ /** A new logger.config.ts importing defineConfig from `pkg`, without the stamp line (init adds it). */
120
+ function template(pkg) {
121
+ return [
122
+ `import { defineConfig } from '${pkg}';`,
123
+ '',
124
+ `// After upgrading, run \`npx ${pkg} init\` again to add options that are new.`,
125
+ 'export default defineConfig({',
126
+ ...optionSection(exports.OPTIONS, ' '),
127
+ '});',
128
+ '',
129
+ ].join('\n');
130
+ }
131
+ // -- Adding missing options to an existing file -------------------------------
132
+ /** The key appears as a property (or a commented-out one): at a line start, or after `{` or `,`. */
133
+ const mentions = (text, key) => new RegExp(`(^|[{,])\\s*(?://\\s*)?['"]?${key}['"]?\\s*:`, 'm').test(text);
134
+ /** A line up to its `//` comment, ignoring `//` inside quotes (URLs in strings). */
135
+ function codeOf(line) {
136
+ let quote = null;
137
+ for (let i = 0; i < line.length; i++) {
138
+ const c = line[i];
139
+ if (quote) {
140
+ if (c === '\\')
141
+ i++;
142
+ else if (c === quote)
143
+ quote = null;
144
+ }
145
+ else if (c === "'" || c === '"' || c === '`')
146
+ quote = c;
147
+ else if (c === '/' && line[i + 1] === '/')
148
+ return line.slice(0, i);
149
+ }
150
+ return line;
151
+ }
152
+ /** Index of the last code character before `end`, skipping whitespace and line comments; -1 when none. */
153
+ function lastCodeChar(text, end) {
154
+ let i = end - 1;
155
+ while (i >= 0) {
156
+ const start = text.lastIndexOf('\n', i) + 1;
157
+ const code = codeOf(text.slice(start, i + 1)).trimEnd();
158
+ if (code.trim() !== '')
159
+ return start + code.length - 1;
160
+ i = start - 2;
161
+ }
162
+ return -1;
163
+ }
164
+ const indentOfLine = (text, at) => /^[ \t]*/.exec(text.slice(text.lastIndexOf('\n', at - 1) + 1))[0];
165
+ /**
166
+ * Insert `lines` just before the `}` at `close`, adding a comma after the last property when it has none.
167
+ * Returns the new text.
168
+ */
169
+ function insertBefore(text, close, lines) {
170
+ const last = lastCodeChar(text, close);
171
+ let out = text;
172
+ if (last >= 0 && out[last] !== ',' && out[last] !== '{') {
173
+ out = out.slice(0, last + 1) + ',' + out.slice(last + 1);
174
+ close++;
175
+ }
176
+ const head = out.slice(0, close).replace(/[ \t]*$/, '');
177
+ const closingIndent = out.slice(head.length, close);
178
+ return `${head}${head.endsWith('\n') ? '' : '\n'}${lines.join('\n')}\n${closingIndent}${out.slice(close)}`;
179
+ }
180
+ /** Works on \n text and gives the file's own line ends back (Windows files stay CRLF). */
181
+ function addMissing(source) {
182
+ const crlf = source.includes('\r\n');
183
+ const result = addMissingLf(crlf ? source.replace(/\r\n/g, '\n') : source);
184
+ return crlf ? { ...result, text: result.text.replace(/\n/g, '\r\n') } : result;
185
+ }
186
+ function addMissingLf(text) {
187
+ const missingTop = exports.OPTIONS.filter((o) => !mentions(text, o.key));
188
+ const filesAt = /files\s*:\s*\{/.exec(text);
189
+ const missingFiles = filesAt ? exports.FILE_OPTIONS.filter((o) => !mentions(text, o.key)) : [];
190
+ const added = [...missingTop.map((o) => o.key), ...missingFiles.map((o) => `files.${o.key}`)];
191
+ if (added.length === 0)
192
+ return { text, added, commentedOnly: false };
193
+ // The exported object closes at the file's last `}`. A function with a block body ends `...; }` instead: there
194
+ // is no object to put values in, but comments are safe anywhere, so the options go above the export as comments.
195
+ const close = text.lastIndexOf('}');
196
+ if (close < 0 || text[lastCodeChar(text, close)] === ';') {
197
+ const exportAt = /^.*(?:export\s+default|module\.exports)/m.exec(text);
198
+ const at = exportAt ? exportAt.index : 0;
199
+ const lines = [
200
+ '// Added by advanced-logger init: options this config does not set. To use one, put it in the object the',
201
+ '// function returns. Left out, each uses the default shown.',
202
+ ...optionSection(missingTop, '', true),
203
+ ...missingFiles.flatMap((o) => optionLines(o, '', true)),
204
+ '',
205
+ ];
206
+ return { text: text.slice(0, at) + lines.join('\n') + '\n' + text.slice(at), added, commentedOnly: true };
207
+ }
208
+ let out = text;
209
+ // Top-level options first: they go at the end, so the files insertion point (earlier in the text) does not move.
210
+ if (missingTop.length > 0) {
211
+ const indent = indentOfLine(out, lastCodeChar(out, close)) || ' ';
212
+ out = insertBefore(out, close, [`${indent}// Added by advanced-logger init: options this file did not mention.`, ...optionSection(missingTop, indent)]);
213
+ }
214
+ if (missingFiles.length > 0) {
215
+ const open = /files\s*:\s*\{/.exec(out);
216
+ const at = open.index + open[0].length;
217
+ const inner = indentOfLine(out, open.index) + ' ';
218
+ const lines = missingFiles.flatMap((o) => optionLines(o, inner));
219
+ // After the `{`: each line ends in a comma, so whatever followed stays valid.
220
+ out = `${out.slice(0, at)}\n${lines.join('\n')}${out[at] === '\n' ? '' : '\n' + inner}${out.slice(at)}`;
221
+ }
222
+ return { text: out, added, commentedOnly: false };
223
+ }
224
+ /**
225
+ * JSON has no comments, so only the common options can be added, as their default values. The advanced ones are
226
+ * left out, which is the same as commented out: the logger picks their defaults.
227
+ */
228
+ function initJson(file) {
229
+ const name = path.basename(file);
230
+ let json;
231
+ try {
232
+ json = JSON.parse(fs.readFileSync(file, 'utf8'));
233
+ }
234
+ catch (err) {
235
+ return { file, action: 'refused', added: [], message: `${name} was left as is: it is not valid JSON (${err.message}).` };
236
+ }
237
+ const added = [];
238
+ for (const o of exports.OPTIONS.filter((x) => !x.advanced && !(x.key in json))) {
239
+ json[o.key] = o.key === 'files' ? { ...FILES_DEFAULT } : o.value;
240
+ added.push(o.key);
241
+ }
242
+ const files = json.files;
243
+ for (const o of exports.FILE_OPTIONS.filter((x) => !added.includes('files') && !(x.key in files))) {
244
+ files[o.key] = o.value;
245
+ added.push(`files.${o.key}`);
246
+ }
247
+ const unset = exports.OPTIONS.filter((o) => o.advanced && !(o.key in json)).map((o) => o.key);
248
+ const advancedNote = unset.length ? ` JSON has no comments, so the advanced options are not listed; left out, they use their defaults: ${unset.join(', ')}.` : '';
249
+ if (added.length === 0)
250
+ return { file, action: 'unchanged', added, message: `${name} already sets every common option.${advancedNote}` };
251
+ (0, configBackup_1.backupConfig)(file);
252
+ fs.writeFileSync(file, JSON.stringify(json, null, 2) + '\n');
253
+ return { file, action: 'updated', added, message: `Added ${added.length} common option(s) to ${name}, set to their defaults: ${added.join(', ')}.${advancedNote}${backedUp(file)}` };
254
+ }
255
+ /** Tells the user where the previous version went and how to get it back. */
256
+ function backedUp(file) {
257
+ const n = (0, configBackup_1.listBackups)(path.dirname(file)).length;
258
+ return ` The previous version is backup ${n} (the newest); "restore ${n}" puts it back.`;
259
+ }
260
+ /**
261
+ * Creates `dir`/logger.config.ts from the template, stamped, or adds the missing options to the first existing
262
+ * config file (CONFIG_FILE_NAMES order), backing it up first. Never removes or rewrites what the file has.
263
+ */
264
+ function init(dir, pkg) {
265
+ const existing = configFile_1.CONFIG_FILE_NAMES.map((n) => path.join(dir, n)).find((f) => fs.existsSync(f));
266
+ if (!existing) {
267
+ const file = path.join(dir, 'logger.config.ts');
268
+ fs.writeFileSync(file, (0, configBackup_1.withStamp)(template(pkg), 'init'));
269
+ return { file, action: 'created', added: [], message: `Created ${file}: common options set to their defaults, advanced ones commented out (the logger picks those).` };
270
+ }
271
+ if (existing.endsWith('.json'))
272
+ return initJson(existing);
273
+ const name = path.basename(existing);
274
+ const result = addMissing(fs.readFileSync(existing, 'utf8'));
275
+ if (result.added.length === 0)
276
+ return { file: existing, action: 'unchanged', added: [], message: `${name} already lists every option.` };
277
+ (0, configBackup_1.backupConfig)(existing);
278
+ fs.writeFileSync(existing, (0, configBackup_1.withStamp)(result.text, 'init'));
279
+ const how = result.commentedOnly
280
+ ? 'as comments above the export (the config is a function, so they could not go in its object)'
281
+ : 'common ones set to their defaults, advanced ones commented out';
282
+ return {
283
+ file: existing,
284
+ action: 'updated',
285
+ added: result.added,
286
+ message: `Added ${result.added.length} missing option(s) to ${name}, ${how}: ${result.added.join(', ')}.${backedUp(existing)}`,
287
+ };
288
+ }
289
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6GA,4BAUC;AA2DD,gCAIC;AA+FD,oBAsBC;AA3SD,4CAA8B;AAC9B,gDAAkC;AAClC,iDAAsE;AACtE,6CAAiD;AAwBjD;;;GAGG;AACU,QAAA,OAAO,GAAa;IAC/B,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,6CAA6C,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,mIAAmI,EAAE;IACjP,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,iCAAiC,EAAE;IAC3G,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,qDAAqD,EAAE;IACtI,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,S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,CAAC,MAAM,yBAAyB,IAAI,KAAK,GAAG,KAAK,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,EAAE;KAC/H,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@void.01/advanced-logger",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Self-contained logger for Playwright/TypeScript. Port of VOID core.logging.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -12,6 +12,9 @@
12
12
  },
13
13
  "main": "./dist/index.js",
14
14
  "types": "./dist/index.d.ts",
15
+ "bin": {
16
+ "advanced-logger": "dist/cli.js"
17
+ },
15
18
  "exports": {
16
19
  ".": {
17
20
  "types": "./dist/index.d.ts",