@ngockhoale/ukit 3.5.10 → 3.5.11

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/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable changes to UKit are documented here.
4
4
 
5
+ ## 3.5.11 - 2026-11-19
6
+
7
+ Hotfix for 3.5.10 output compression. Since 3.5.10 the summary replaces the Bash output on Claude Code, and the replacement also hit commands whose output *is* the content: `sed -n 25,120p file` returned ten mangled lines instead of the code, and chained status commands (`node -p …; npm view …; git status`) lost whole sections.
8
+
9
+ - **Content reads pass through raw.** `cat`, `sed`, `head`, `tail`, `nl`, `bat`, `less`, `more`, `jq`, `diff`, `awk`, `cut`, `git show`/`diff`/`blame`/`cat-file` and `git log -p` are never summarized. Listing-only `git diff --stat`/`--name-only` still compress.
10
+ - **Bounded and chained commands pass through raw.** A pipeline that already ends in `head`/`tail`/`sed`, or several commands chained with `;`/`&&`/`||` (a leading `cd …` is ignored), keeps its full output.
11
+ - Test runs, builds, installs, searches and long listings compress exactly as in 3.5.10.
12
+
5
13
  ## 3.5.10 - 2026-11-19
6
14
 
7
15
  Sessions compacted after two or three prompts. Three causes, all fixed at the source; no new command. No host was run live; the checks are unit, parity and hook-process tests.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngockhoale/ukit",
3
- "version": "3.5.10",
3
+ "version": "3.5.11",
4
4
  "description": "Install/update an index-first AI workspace for Claude Code, OpenAI Codex and omp (Oh My Pi).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1388,6 +1388,81 @@ function shouldCompress(config) {
1388
1388
  return Boolean(config?.tokenPipeline?.outputCompression);
1389
1389
  }
1390
1390
 
1391
+ // 3.5.11 quality fix: since 3.5.10 a summary REPLACES the Bash output on Claude Code.
1392
+ // For commands whose output is the content the model asked to read (cat/sed -n/head/
1393
+ // git diff …), for output already bounded by a trailing head/tail/sed stage, and for
1394
+ // chained commands (`a; b && c`) whose sections the line picker cannot keep apart, a
1395
+ // lossy summary drops source text or misfiles sections — quality > token savings, so
1396
+ // these pass through untouched.
1397
+ const VERBATIM_READ_HEADS = new Set([
1398
+ 'cat', 'sed', 'head', 'tail', 'nl', 'bat', 'less', 'more', 'jq', 'diff', 'awk', 'cut',
1399
+ ]);
1400
+ const VERBATIM_GIT_SUBCOMMANDS = new Set(['show', 'diff', 'blame', 'cat-file']);
1401
+ const BOUNDING_TAIL_STAGES = new Set(['head', 'tail', 'sed']);
1402
+
1403
+ function splitShellCommand(command) {
1404
+ const segments = [];
1405
+ let current = '';
1406
+ let ops = [];
1407
+ let quote = '';
1408
+ const text = String(command ?? '');
1409
+ for (let i = 0; i < text.length; i += 1) {
1410
+ const ch = text[i];
1411
+ if (quote) {
1412
+ if (ch === '\\' && quote === '"' && i + 1 < text.length) { current += ch + text[i + 1]; i += 1; continue; }
1413
+ if (ch === quote) quote = '';
1414
+ current += ch;
1415
+ continue;
1416
+ }
1417
+ if (ch === '\\' && i + 1 < text.length) { current += ch + text[i + 1]; i += 1; continue; }
1418
+ if (ch === '"' || ch === "'") { quote = ch; current += ch; continue; }
1419
+ const two = text.slice(i, i + 2);
1420
+ if (two === '&&' || two === '||') { segments.push(current); ops.push(two); current = ''; i += 1; continue; }
1421
+ if (ch === ';' || ch === '\n' || ch === '|') { segments.push(current); ops.push(ch === '|' ? '|' : ';'); current = ''; continue; }
1422
+ current += ch;
1423
+ }
1424
+ segments.push(current);
1425
+ return { segments: segments.map((s) => s.trim()), ops };
1426
+ }
1427
+
1428
+ function segmentWords(segment) {
1429
+ const words = segment.split(/\s+/).filter(Boolean);
1430
+ while (words.length && /^[A-Za-z_][A-Za-z0-9_]*=/.test(words[0])) words.shift();
1431
+ return words;
1432
+ }
1433
+
1434
+ export function isVerbatimOutputCommand(command) {
1435
+ const { segments, ops } = splitShellCommand(command);
1436
+ // Group pipe stages into pipelines; drop `cd …` navigation pipelines.
1437
+ const pipelines = [];
1438
+ let stages = [segments[0]];
1439
+ for (let i = 0; i < ops.length; i += 1) {
1440
+ if (ops[i] === '|') stages.push(segments[i + 1]);
1441
+ else { pipelines.push(stages); stages = [segments[i + 1]]; }
1442
+ }
1443
+ pipelines.push(stages);
1444
+ const meaningful = pipelines
1445
+ .map((p) => p.filter(Boolean))
1446
+ .filter((p) => p.length > 0 && !(p.length === 1 && segmentWords(p[0])[0] === 'cd'));
1447
+ if (meaningful.length > 1) return true;
1448
+ if (meaningful.length === 0) return false;
1449
+ const pipeline = meaningful[0];
1450
+ const first = segmentWords(pipeline[0]);
1451
+ const head = (first[0] || '').replace(/^.*\//, '');
1452
+ if (VERBATIM_READ_HEADS.has(head)) return true;
1453
+ if (head === 'git') {
1454
+ const sub = first.slice(1).find((w) => !w.startsWith('-'));
1455
+ const listingOnly = first.some((w) => /^--(stat|numstat|shortstat|name-only|name-status)\b/.test(w));
1456
+ if (VERBATIM_GIT_SUBCOMMANDS.has(sub) && !listingOnly) return true;
1457
+ if (sub === 'log' && first.some((w) => w === '-p' || w === '--patch')) return true;
1458
+ }
1459
+ if (pipeline.length > 1) {
1460
+ const last = segmentWords(pipeline[pipeline.length - 1]);
1461
+ if (BOUNDING_TAIL_STAGES.has((last[0] || '').replace(/^.*\//, ''))) return true;
1462
+ }
1463
+ return false;
1464
+ }
1465
+
1391
1466
  function mergeDeep(base, override) {
1392
1467
  if (!override || typeof override !== 'object' || Array.isArray(override)) {
1393
1468
  return override === undefined ? base : override;
@@ -1482,6 +1557,12 @@ async function main() {
1482
1557
  return;
1483
1558
  }
1484
1559
 
1560
+ // 3.5.11: content reads, bounded pipelines and chained commands pass through raw.
1561
+ if (isVerbatimOutputCommand(command)) {
1562
+ process.exit(0);
1563
+ return;
1564
+ }
1565
+
1485
1566
  const requestKey = buildCompactMachineKey('tool-output-v1', {
1486
1567
  command,
1487
1568
  stdoutHash: buildCompactMachineKey('stdout', stripAnsi(stdout)),