@shrkcrft/compress 0.1.0-alpha.21 → 0.1.0-alpha.22

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.
@@ -1 +1 @@
1
- {"version":3,"file":"detect-content-type.d.ts","sourceRoot":"","sources":["../../src/content/detect-content-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AA0FjD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAuG5D"}
1
+ {"version":3,"file":"detect-content-type.d.ts","sourceRoot":"","sources":["../../src/content/detect-content-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAgGjD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CA4G5D"}
@@ -17,7 +17,13 @@ const YAML_INDENTED_SEQ = /^\s{2,}-\s/;
17
17
  // Log levels must appear as a LINE PREFIX (optionally after a leading
18
18
  // timestamp / bracket), not anywhere on the line — otherwise common code
19
19
  // identifiers (`const ERROR = 500`, `enum { INFO, DEBUG }`) misroute to logs.
20
- const LOG_MARKER = /^\s*(?:(?:\[?\d{4}-\d{2}-\d{2}[T ][\d:.,]+\]?|\S+\[\d+\]:)\s+)?\[?(?:ERROR|FATAL|FAIL(?:ED|URE)?|WARN(?:ING)?|INFO|DEBUG|NOTICE|TRACE)\b|^\S+\[\d+\]:\s|^\s*Traceback\b|^\s+at\s+\S+\s*\(|^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}/;
20
+ // A bare clock timestamp (`HH:MM:SS`, optionally bracketed / with millis) is
21
+ // also a valid log prefix: it appears as the optional leading-prefix before a
22
+ // level keyword AND as a standalone line-start (a timestamp-led log line with
23
+ // no level word). Without these, `[10:00:00] INFO` / `10:00:00 ...` lines match
24
+ // SEARCH_LINE (the `HH:MM:` shape looks like `token:digits:`) and the blob
25
+ // misroutes to search-results — a lossy compressor for what is really a log.
26
+ const LOG_MARKER = /^\s*(?:(?:\[?\d{4}-\d{2}-\d{2}[T ][\d:.,]+\]?|\S+\[\d+\]:|\[?\d{1,2}:\d{2}:\d{2}(?:[.,]\d+)?\]?)\s+)?\[?(?:ERROR|FATAL|FAIL(?:ED|URE)?|WARN(?:ING)?|INFO|DEBUG|NOTICE|TRACE)\b|^\S+\[\d+\]:\s|^\s*Traceback\b|^\s+at\s+\S+\s*\(|^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}|^\s*\[?\d{1,2}:\d{2}:\d{2}(?:[.,]\d+)?\]?\s/;
21
27
  const MARKDOWN_MARKER = /^(?:#{1,6}\s|\s*[-*]\s|\s*\d+\.\s|```|>\s|\|)/;
22
28
  // Code signals: declaration keywords + structural/statement shapes that real
23
29
  // code has but prose / markdown / INI / env / TOML / nginx do NOT (each new
@@ -120,8 +126,11 @@ export function detectContentType(text) {
120
126
  return EContentType.GitDiff;
121
127
  }
122
128
  // 3. grep / ripgrep search output (`path:line:` prefix) OR compiler
123
- // diagnostics (`path(line,col):`). Count either shape toward the ratio.
124
- if (lineHitRatio(lines, (l) => SEARCH_LINE.test(l) || DIAGNOSTIC_LINE.test(l)) >= 0.6) {
129
+ // diagnostics (`path(line,col):`). Count either shape toward the ratio,
130
+ // but EXCLUDE log-shaped lines: a `HH:MM:SS` clock satisfies the
131
+ // `token:digits:` SEARCH_LINE shape, so timestamped logs would otherwise
132
+ // win here (ratio ≥ 0.6) before the BuildLog check below ever runs.
133
+ if (lineHitRatio(lines, (l) => (SEARCH_LINE.test(l) || DIAGNOSTIC_LINE.test(l)) && !LOG_MARKER.test(l)) >= 0.6) {
125
134
  return EContentType.SearchResults;
126
135
  }
127
136
  // 4. Build / test log (error / warn / timestamp markers dense enough).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shrkcrft/compress",
3
- "version": "0.1.0-alpha.21",
3
+ "version": "0.1.0-alpha.22",
4
4
  "description": "SharkCraft deterministic context-compression engine: content routing, lossless columnar/table compaction, log/search/diff line reduction, and reversible Compress-Cache-Retrieve (CCR). No model inside — every transform is a pure function of its input.",
5
5
  "license": "MIT",
6
6
  "author": "SharkCraft contributors",
@@ -44,7 +44,7 @@
44
44
  "typecheck": "tsc --noEmit -p tsconfig.json"
45
45
  },
46
46
  "dependencies": {
47
- "@shrkcrft/core": "^0.1.0-alpha.21"
47
+ "@shrkcrft/core": "^0.1.0-alpha.22"
48
48
  },
49
49
  "publishConfig": {
50
50
  "access": "public"