@dzhechkov/harness-cli 0.3.199 → 0.3.201

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dzhechko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -132,7 +132,7 @@ point any tool at (a skill is just Markdown). Dedicated targets are on the [road
132
132
 
133
133
  ## User Journey — from install to mastery
134
134
 
135
- All 39 commands mapped to a real workflow:
135
+ All 41 commands mapped to a real workflow:
136
136
 
137
137
  ```
138
138
  DISCOVER → INSTALL → USE → CREATE → MAINTAIN → SHARE
@@ -356,7 +356,7 @@ Get the whole set with `dz init --target claude-code --preset meta`, or pick one
356
356
 
357
357
  > **A skill and its npx toolkit are not duplicates — they're a graduation.** Several skills (e.g. `feature-adr`, `design-thinking`) exist BOTH as a skill inside a `dz` preset AND as a standalone `npx` package. The preset's SKILL.md is **fully functional on its own** (the whole methodology — modules + references — travels with it, and it auto-activates by description), and it's the only way to compile that capability to the **non-Claude platforms** (Codex/OpenCode/Hermes/OpenClaude) via `dz`. The npx package adds **project-level runtime governance** around the same skill: a slash command, governance rules, a context shard, and (for feature-adr) reward-learning + `/harvest`. So: pick the **skill/preset** for a working capability across platforms; pick the **npx toolkit** when you want it as a governed, command-driven fixture of one project.
358
358
 
359
- ## All Commands (40)
359
+ ## All Commands (41)
360
360
 
361
361
  ```
362
362
  dz setup --target <name> [--preset <name>] [--select id,id,...] [--skills-dir <dir>] [--memory agentdb] [--no-memory] [--no-hooks] [--install-driver] [--force]
@@ -376,7 +376,8 @@ dz vector import <file.rvf> [--project <dir>] [--json] # RVF import
376
376
  dz vector harmonize [--apply] [--threshold <0..1>] [--json] # SEMANTIC merge of near-dups (dry-run default; --apply after a restorable backup)
377
377
  dz teach --harmonize [--apply] [--threshold <0..1>] # alias of `dz vector harmonize`
378
378
  dz statusline [--json] [--install] # compact Claude Code statusline: live self-learning pattern count + brain sources
379
- dz usage [--json] [--project <dir>] # ESTIMATE Claude session (5h-block) + weekly (7d) token usage from local transcripts; exit 0 ALWAYS; pct=null when limits unconfigured
379
+ dz usage [--json] [--project <dir>] | --calibrate --session <pct> --weekly <pct> [--model fable=<pct>] # ESTIMATE Claude usage from fixed reset windows; optional per-model weekly binding; exit 0 ALWAYS
380
+ dz claim-check [paths...] [--json] [--fail-on high|medium|none] [--project <dir>] # enforce the Integrity Rule: flag untagged/overstated accuracy claims; default scan = READMEs + features' 08_qe_report.md; exit 1 only at/above --fail-on (default high)
380
381
  dz brain list [--json] # the durable cross-project knowledge brain
381
382
  dz brain query "<q>" [--source <slug>] [--limit <N>] [--any] [--rerank] [--json] # cross-source recall (--any = OR match; --rerank reorders on-point first). Auto-broadens: if strict all-terms match yields 0 hits, it retries once as OR and labels the result "broadened" (text note + broadened:true in --json) instead of returning empty. Explicit --any is OR from the start (never labeled broadened).
382
383
  dz brain add [--source <slug>] [--project <dir>] [--from-slice <f>|--from-pack <p>|--from-kus <f> --slug <s> --kind <k> --license <spdx> [--override]] [--json] # grow the brain
@@ -400,7 +401,7 @@ dz create-skill --name <id> [--description <text>] [--tier 1|2|3] [--with-r
400
401
  dz registry [search <query>] [--category <cat>]
401
402
  dz benchmark <skill-dir> [--compare <dir>] [--all]
402
403
  dz mcp-scan [path] [--json] (static agent-permission audit; exit 0/1/2 = clean/medium/high)
403
- dz publish [--filter <name>] [--bump-only] (dry-run by default; pass --yes/--confirm to go live)
404
+ dz publish [--filter <name>] [--bump-only] [--claim-check <off|warn|error>] (dry-run by default; pass --yes/--confirm to go live; claim-check gate defaults to warn — surfaces README claim findings, never blocks)
404
405
  dz auto-canonicalize --source <github-url> --pack <skills-pack>
405
406
  dz sync-upstream [--package <dir>] [--list] [--all]
406
407
  dz drift-check [--all] [--json] [--project <dir>] # CI gate: exit 1 on NEW shared-skill drift (baseline: .dz/drift-allowlist.json; --all incl .claude dogfood)
@@ -467,29 +468,103 @@ Modeled on the Agentic QE statusline pattern (e.g. AQE's `🎓 12 patterns`).
467
468
 
468
469
  ### Usage estimate (`dz usage`)
469
470
 
470
- `dz usage` prints a READONLY, never-throw ESTIMATE of Claude SESSION (active 5h-block) and WEEKLY
471
- (rolling 7d) token usage, aggregated from your local `~/.claude/projects/**/*.jsonl` transcripts:
471
+ `dz usage` prints a READONLY, never-throw ESTIMATE of Claude SESSION and WEEKLY token usage,
472
+ aggregated from your local `~/.claude/projects/**/*.jsonl` transcripts. Weekly counts start at the
473
+ configured fixed local anchor (`memory.usage.weeklyResetAnchor`, for example `Wed 08:59`). Session
474
+ counts use the active fixed-length transcript block (`memory.usage.sessionBlockHours`, normally `5`).
472
475
 
473
476
  ```bash
474
- dz usage # session ~74% (resets 19:00) · week ~52% (resets Sat) · estimated
475
- dz usage --json # {"sessionPct":74,"weeklyPct":52,"sessionTokens":…,"resetsAt":{},"limits":{},"estimated":true}
477
+ dz usage # session ~74% (resets 19:00) · week ~76% fable-bound (resets 08:59) · estimated
478
+ dz usage --json # {"sessionPct":74,"weeklyPct":76,"sessionTokens":...,"weeklyTokens":...,"resetsAt":{...},"limits":{...},"estimated":true}
476
479
  ```
477
480
 
478
481
  **Exit code is 0 ALWAYS** (even unconfigured/error → all-null JSON) — a probe must never distinguish
479
- "usage unknown" from "command failed" via a non-zero exit. Percentages are **ESTIMATES** (there is no
480
- official usage API); they are `null` until you configure the plan-dependent limits in `.dz/config.json`:
482
+ "usage unknown" from "command failed" via a non-zero exit. Percentages are **ESTIMATES** from local
483
+ transcripts; claude.ai/settings/usage is authoritative. They are `null` until you configure the
484
+ plan-dependent limits in `.dz/config.json`:
481
485
 
482
486
  ```json
483
- { "memory": { "usage": { "sessionTokenLimit": 200000000, "weeklyTokenLimit": 1000000000 } } }
487
+ {
488
+ "memory": {
489
+ "usage": {
490
+ "sessionTokenLimit": 200000000,
491
+ "weeklyTokenLimit": 1000000000,
492
+ "weeklyResetAnchor": "Wed 08:59",
493
+ "sessionBlockHours": 5,
494
+ "weeklyTokenLimitByModel": { "fable": 500000000 }
495
+ }
496
+ }
497
+ }
498
+ ```
499
+
500
+ `sessionTokenLimit` and `weeklyTokenLimit` are optional; absent means that pct is `null` (unknown,
501
+ never `0`). `weeklyTokenLimit` is the all-model weekly limit. `weeklyTokenLimitByModel` is optional;
502
+ when it has at least one valid model limit (`fable`, `opus`, `sonnet`, or `haiku`), `weeklyPct` is the
503
+ binding per-model percentage and `--json` adds:
504
+
505
+ ```json
506
+ {
507
+ "weeklyByModel": { "fable": { "tokens": 380, "pct": 76 } },
508
+ "limits": { "session": 200000000, "weekly": 1000000000, "weeklyByModel": { "fable": 500 } }
509
+ }
510
+ ```
511
+
512
+ When no per-model limits are configured, the JSON shape stays at the legacy fields:
513
+ `sessionPct`, `weeklyPct`, `sessionTokens`, `weeklyTokens`, `resetsAt`, `limits`, `estimated`.
514
+
515
+ Calibrate from human-transcribed claude.ai percentages with one command:
516
+
517
+ ```bash
518
+ dz usage --calibrate --session 20 --weekly 50 --model fable=76 --project .
484
519
  ```
485
520
 
486
- Both keys are OPTIONAL absent that `pct` is `null` (unknown, never `0`). **Calibrate** by scaling a
487
- limit by `X/100` when a real limit-hit lands at an estimated `X%` (observed-exhaustion calibration).
521
+ It computes each limit as `currentTokens / (pct / 100)`, writes only `memory.usage` in
522
+ `.dz/config.json`, and records `calibratedAt` plus `source: "claude.ai/settings/usage"`. Invalid
523
+ percentages, unknown models, missing transcripts, and zero-token calibration requests are skipped with
524
+ exit code `0`.
525
+
488
526
  This feeds `/feature-adr`'s **usage-adaptive routing** — the pipeline probes `dz usage --json` at each
489
- phase boundary and pre-emptively routes the remaining stages to Codex when usage crosses the threshold
490
- (default 70%). **Honest caveat:** at TRUE exhaustion even the Codex dispatch dies (`codex:codex-rescue`
491
- is a Claude wrapper), so the switch must happen BEFORE — the pre-emptive probe, not reactive detection,
492
- is the real defense.
527
+ phase boundary and pre-emptively routes the remaining stages to Codex when `sessionPct` or the binding
528
+ `weeklyPct` crosses the threshold (default 70%). **Honest caveat:** at TRUE exhaustion even the Codex
529
+ dispatch dies (`codex:codex-rescue` is a Claude wrapper), so the switch must happen BEFORE — the
530
+ pre-emptive probe, not reactive detection, is the real defense.
531
+
532
+ ### Claim check (`dz claim-check`)
533
+
534
+ Makes the Integrity Rule — *"no fake claims; verify before claiming success"* — a runnable check
535
+ instead of prose. Every quantitative claim (coverage, test/skill/command counts, benchmarks) must be
536
+ tagged `MEASURED` / `CLAIMED` / `SYNTHETIC` / `ESTIMATED` / `UNVALIDATED` / `BASELINE`, and a
537
+ `MEASURED` claim must name its reproducer (`npm test`, a coverage report, `npm view`, a git ref).
538
+ "100% / perfect" framing is always high severity.
539
+
540
+ ```bash
541
+ dz claim-check # scans root README, every package README, features/*/08_qe_report.md
542
+ dz claim-check docs/perf.md --json # {"ok":false,"findings":[…],"scanned":[…]}
543
+ dz claim-check --fail-on medium # stricter gate for CI
544
+ ```
545
+
546
+ **Exit-code contract:** `0` when ok; `1` only when a finding at or above `--fail-on` (default `high`)
547
+ exists. `--json` always emits valid JSON, even on the failure path, and never throws on an
548
+ unreadable, binary, or missing file — those are skipped and reported in `scanned`.
549
+
550
+ `dz publish` runs the same check over each package's README. The gate defaults to `warn`: findings
551
+ are surfaced but publish status is **never** changed. Pass `--claim-check error` to fail a package
552
+ that carries a high-severity claim, or `--claim-check off` to disable it.
553
+
554
+ ```bash
555
+ dz publish --filter harness-cli # warn (default): prints "⚠ claim-check: N finding(s) (M high)"
556
+ dz publish --filter harness-cli --claim-check error # a high finding fails THIS package only
557
+ dz publish --filter harness-cli --claim-check off # disable the gate entirely
558
+ ```
559
+
560
+ Ported from rUv's [`ruview`](https://www.npmjs.com/package/@ruvnet/ruview) `src/guardrails.js` (MIT),
561
+ which was itself written after a documented AI-slop incident. The detection semantics are kept
562
+ verbatim — including a deliberately `\b`-free `100%` regex that looks like a bug and is not.
563
+
564
+ **Honest note:** run on this repo it reports hundreds of medium findings and a handful of high ones
565
+ (reproducer: `dz claim-check --json`, which prints the exact current counts — deliberately not frozen
566
+ into this README, since any doc edit moves them). That is the point of the tool, not a defect in it:
567
+ the high findings are real untagged perfect-score claims in our own documentation.
493
568
 
494
569
  ### Targets (10 platforms — 5 lossless + Copilot + AGENTS.md + Cursor + Gemini + Windsurf)
495
570
 
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAyJH,2EAA2E;AAC3E,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAitGD,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,GAAE,KAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAgH5E"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA8JH,2EAA2E;AAC3E,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAyiHD,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,GAAE,KAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAkH5E"}