@dzhechkov/harness-cli 0.3.221 → 0.3.223

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/README.md CHANGED
@@ -431,7 +431,7 @@ Get the whole set with `dz init --target claude-code --preset meta`, or pick one
431
431
 
432
432
  > **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.
433
433
 
434
- ## All Commands (47)
434
+ ## All Commands (49)
435
435
 
436
436
  ```
437
437
  dz setup --target <name> [--preset <name>] [--select id,id,...] [--skills-dir <dir>] [--memory agentdb] [--no-memory] [--no-hooks] [--install-driver] [--force]
@@ -481,6 +481,8 @@ dz architecture [--json] [--revise] [--check --slug <s> --desc "<text>" [--
481
481
  dz project-skills [--json] [--stages-json] # polymorphic feature-adr: resolve architecture/project-skills.json (fixed roles product-vision/critic/brand/impl-bar + open extra[]) into per-stage guidance; absent = generic run (byte-identical); feature-adr Step 0 reads it
482
482
  dz mr-rakes [--json] [--candidate N --confirmed N] [--teach] [--gen-critic <path> [--apply]] # mine review artifacts (features' QE reports + REVIEW files) for RECURRING mistakes; anti-noise (≥2/≥3 distinct sources); close into dz teach + a project-critic skill (R2 critic role)
483
483
  dz retro [transcript] [--json] [--threshold N] [--no-teach] [--install-hook] # per-session retro: mine the current session for recurring PROCESS rakes (claimed-done-without-verify, committed-without-verify, n-fix-cycles, ignored-correction), drill the user (socratic + checklist) AND teach the agent — co-learning via the dz teach store
484
+ dz feature-adr-setup [--plan] [--from-spec <f>] [--apply] # guided project onboarding engine (behind the `configure-feature-adr` skill): --plan shows which docs exist/missing; --from-spec scaffolds vision/map/testing/project-skills (propose; --apply writes; augment-never-clobber)
485
+ dz challenge --plan <plan.md> [--json] [--context-only] [--author <model>] # adversarial plan-gate (behind the `challenge-panel` skill): assemble a WIDE context pack (plan + vision + testing + map + degradations) + the fixed C1-C8 "break it" brief for a FRESH adversary (≠ plan author); advisory, never blocks
484
486
  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)
485
487
  dz auto-canonicalize --source <github-url> --pack <skills-pack>
486
488
  dz sync-upstream [--package <dir>] [--list] [--all]
@@ -1343,6 +1345,30 @@ claude mcp add agentdb --env AGENTDB_PATH="$PWD/.dz/agentdb.db" -- npx agentdb@l
1343
1345
  Four commands that make the harness *self-aware*: it maps your product, keeps new features aligned to it, and
1344
1346
  learns from your reviews and sessions. Each shows **when to reach for it**, the exact command, and what it prints.
1345
1347
 
1348
+ ### 🚀 Start here: the guided setup (no schema knowledge needed)
1349
+
1350
+ Don't want to hand-author any config? Just tell Claude Code:
1351
+
1352
+ > **"настрой feature-adr под мой продукт"** / **"configure feature-adr for my product"**
1353
+
1354
+ The `configure-feature-adr` skill runs a short interview and scaffolds everything for you. Under the hood it
1355
+ uses the engine directly if you prefer the terminal:
1356
+ ```bash
1357
+ dz feature-adr-setup --plan # which docs exist / are discoverable / are missing (read-only)
1358
+ dz feature-adr-setup --from-spec spec.json # preview the scaffold (create / augment / unchanged)
1359
+ dz feature-adr-setup --from-spec spec.json --apply # write — existing files are AUGMENTED, never clobbered
1360
+ ```
1361
+ ```
1362
+ feature-adr project setup — current state:
1363
+ vision.md: ✓ manifest: ✓ testing.md: ✗ missing project-skills.json: ✓
1364
+ discovered 47 workspace package(s) → a map can be auto-scaffolded
1365
+ next steps:
1366
+ • author architecture/testing.md from a short interview (test commands, definition of done, gates)
1367
+ ```
1368
+ It writes `architecture/vision.md`, `subsystems.manifest.json`, `testing.md` (the new `testing` role → Step-8
1369
+ QE), and wires `project-skills.json`. Re-run any time the product grows — it only augments, never overwrites.
1370
+ The four commands below are what it configures; you can also drive them directly.
1371
+
1346
1372
  ### `dz architecture` — when you've lost the big picture, or before adding a feature
1347
1373
 
1348
1374
  ```bash
@@ -1404,6 +1430,36 @@ retro: 2 recurring rake(s) to drill (from 6800 events):
1404
1430
  First-seen rakes accrue silently; only **recurring** ones get a drill (no nagging on a one-off). The user gets the
1405
1431
  drill, the agent gets the taught rule — from the same mistake, out of one shared `dz teach` store.
1406
1432
 
1433
+ ### `dz challenge` — when you have an implementation plan and want it broken BEFORE you code
1434
+
1435
+ The cross-model QE at feature-adr Step 8 catches problems *after* the code is written. The most expensive plan
1436
+ mistakes — overengineering, silent decisions, cemented bad patterns, test-theater, unrealistic scope — cement at
1437
+ the plan stage, and the plan's author can't see their own gaps. `dz challenge` assembles the "round"; the
1438
+ `challenge-panel` skill fires it at a FRESH adversary that did **not** write the plan:
1439
+ ```bash
1440
+ dz challenge --plan features/my-feature/06_implementation_plan.md # print the WIDE brief + C1-C8 + verdict schema
1441
+ dz challenge --plan features/my-feature/06_implementation_plan.md --context-only # just what the panel will read + the adversary to use
1442
+ dz challenge --plan features/my-feature/06_implementation_plan.md --author codex # who wrote the plan → prints the CROSS-family adversary
1443
+ ```
1444
+ ```
1445
+ challenge context for features/my-feature/06_implementation_plan.md:
1446
+ plan: ✓ 23752 chars
1447
+ vision: ✓ 2443 chars
1448
+ testing: ✗ (less calibration)
1449
+ map: ✓ 4470 chars
1450
+ degradations:✓ 719 chars
1451
+ → adversary: codex — plan authored on claude (Claude) → Codex adversary (cross-family)
1452
+ ```
1453
+ The panel asks a fixed owner-question set in "break it, don't confirm it" mode — **C1** arch-anti-cement (a
1454
+ deviation from a pattern in `architecture/degradations.md` is *not* flagged), **C2** prod-ready, **C3** test
1455
+ sufficiency + honesty (both under- and over-testing), **C4** overengineering, **C5** silent decisions, **C6**
1456
+ runtime consistency, **C7** scope, **C8** executability. Every P0/P1 finding is **cross-validated** by a second
1457
+ independent agent (theory is dropped), and the verdict is **advisory — it never auto-blocks**. Two invariants:
1458
+ the panel is never the plan's own author (cross-family adversary), and the context pack is WIDE (a narrow slice
1459
+ yields shallow findings). In the feature-adr pipeline this runs automatically at the L/XL plan checkpoint; ad-hoc,
1460
+ just say **"прогони challenge на этот план"** / **"challenge this plan"**. Scaffold the degradations registry with
1461
+ `dz feature-adr-setup --from-spec <spec with {"degradations":true}> --apply`.
1462
+
1407
1463
  ## Recipes & FAQ
1408
1464
 
1409
1465
  Scenario → exact command → how to verify → gotcha. **Three gotchas worth calling out up front:**
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;AAgNH,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;AA2xID,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,GAAE,KAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CA8H5E"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA0NH,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;AAy4ID,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,GAAE,KAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAkI5E"}
package/dist/cli.js CHANGED
@@ -9,7 +9,7 @@ import { fileURLToPath } from 'node:url';
9
9
  import { execSync } from 'node:child_process';
10
10
  import { homedir } from 'node:os';
11
11
  import { createRequire } from 'node:module';
12
- import { createSkill, getSkillInfo, getWorkflow, isTargetName, listSkills, runDoctor, runInit, benchmarkSkill, benchmarkSkills, scanMcp, reconcileCapabilities, RECONCILE_BANNER, buildRegistry, discoverSkillPackDirs, checkUpstream, compareSkills, checkAllUpstream, sweepSkillDrift, syncCanonicalSkill, checkUpgrades, discoverPackages, discoverSourcePackages, fetchAllDownloads, filterByCategory, pretrain, recommend, generatePlugin, publishPackages, runSetup, runMigrate, searchRegistry, runSync, runVerify, runInitAgentsMd, runInitGeminiMd, TARGET_NAMES, WORKFLOW_NAMES, importEcc, recordPattern, resolveLearningBackend, storeStats, consolidateSessions, pruneNoisePatterns, lessonDeltaReport, removePatternsByIds, snapshotStore, recallHybrid, teachGuard, mirrorPatternsToVector, vectorMirrorEnabled, vectorTierStatus, resolveVectorEngine, reindexVectorStore, harmonizeVectorStore, importRvfCheckpoint, statuslineData, writeFeatureAdrState, computeUsage, deriveUsageCalibration, normalizeClaudeUsageModelKey, readUsageLimits, claimCheck, summarize, queryBookKnowledge, loadStorePatternsSync, patternRecordId, loadStoreRecords, recordToPattern, bundleSkills, brainHome, listBrain, promoteProjectToBrain, updateBrainSource, queryBrain, groundPrompt, expandKu, reindexBrainVectors, buildPrimer, exportBrainSlice, importBrainSlice, registerKusToBrain, RECALL_USAGE_LOG_RELATIVE, RECALL_USAGE_LOG_MAX_BYTES, parseRecallUsageLog, buildRecallUsageReport, buildManifest, buildSbom, resolveTrustRoot, decideVerifyPolicy, decideProvenance, isInsideTree, signManifest, verifyManifest, assertKeyOutsideTree, decidePublishGate, MANIFEST_NAME, SBOM_NAME, buildArchitectureMap, renderMapHuman, findArchitectureDrift, renderDriftReport, scanWorkspacePackages, loadSubsystemManifest, loadProductVision, checkFeatureAgainstArchitecture, renderArchCheck, planProjectSkills, guidanceForStage, renderInjectionReport, analyzeCorpus, renderRakeReport, renderCriticSection, rakeAsLesson, rakeReward, DEFAULT_RAKE_THRESHOLDS, streamSessionEvents, findLatestTranscript, detectProcessRakes, buildRetro, renderRetro, retroLessonText, PROCESS_SIGNATURES, RETRO_DOMAIN, } from '@dzhechkov/harness-core';
12
+ import { createSkill, getSkillInfo, getWorkflow, isTargetName, listSkills, runDoctor, runInit, benchmarkSkill, benchmarkSkills, scanMcp, reconcileCapabilities, RECONCILE_BANNER, buildRegistry, discoverSkillPackDirs, checkUpstream, compareSkills, checkAllUpstream, sweepSkillDrift, syncCanonicalSkill, checkUpgrades, discoverPackages, discoverSourcePackages, fetchAllDownloads, filterByCategory, pretrain, recommend, generatePlugin, publishPackages, runSetup, runMigrate, searchRegistry, runSync, runVerify, runInitAgentsMd, runInitGeminiMd, TARGET_NAMES, WORKFLOW_NAMES, importEcc, recordPattern, resolveLearningBackend, storeStats, consolidateSessions, pruneNoisePatterns, lessonDeltaReport, removePatternsByIds, snapshotStore, recallHybrid, teachGuard, mirrorPatternsToVector, vectorMirrorEnabled, vectorTierStatus, resolveVectorEngine, reindexVectorStore, harmonizeVectorStore, importRvfCheckpoint, statuslineData, writeFeatureAdrState, computeUsage, deriveUsageCalibration, normalizeClaudeUsageModelKey, readUsageLimits, claimCheck, summarize, queryBookKnowledge, loadStorePatternsSync, patternRecordId, loadStoreRecords, recordToPattern, bundleSkills, brainHome, listBrain, promoteProjectToBrain, updateBrainSource, queryBrain, groundPrompt, expandKu, reindexBrainVectors, buildPrimer, exportBrainSlice, importBrainSlice, registerKusToBrain, RECALL_USAGE_LOG_RELATIVE, RECALL_USAGE_LOG_MAX_BYTES, parseRecallUsageLog, buildRecallUsageReport, buildManifest, buildSbom, resolveTrustRoot, decideVerifyPolicy, decideProvenance, isInsideTree, signManifest, verifyManifest, assertKeyOutsideTree, decidePublishGate, MANIFEST_NAME, SBOM_NAME, buildArchitectureMap, renderMapHuman, findArchitectureDrift, renderDriftReport, scanWorkspacePackages, loadSubsystemManifest, loadProductVision, checkFeatureAgainstArchitecture, renderArchCheck, planProjectSkills, guidanceForStage, renderInjectionReport, analyzeCorpus, renderRakeReport, renderCriticSection, rakeAsLesson, rakeReward, DEFAULT_RAKE_THRESHOLDS, streamSessionEvents, findLatestTranscript, detectProcessRakes, buildRetro, renderRetro, retroLessonText, PROCESS_SIGNATURES, RETRO_DOMAIN, scanForSetup, buildSetupPlan, scaffoldFromSpec, renderScaffoldPreview, readExistingForScaffold, assembleChallengeContext, buildChallengeBrief, pickAdversaryModel, CHALLENGE_QUESTIONS, } from '@dzhechkov/harness-core';
13
13
  import { getPreset, PRESET_NAMES } from '@dzhechkov/harness-presets';
14
14
  import { scanGitHub, analyzeRepo, generateReport, deepAnalyze, scanAllSources, ScoutMemory } from '@dzhechkov/scout';
15
15
  const USAGE = `dz - DZ cross-platform harness CLI
@@ -4121,6 +4121,134 @@ async function cmdRetro(options, flags, cwd, write) {
4121
4121
  }
4122
4122
  return 0;
4123
4123
  }
4124
+ /**
4125
+ * `dz feature-adr-setup` — the deterministic engine behind the `configure-feature-adr` SKILL (R5). Scaffolds
4126
+ * the project-awareness files (vision / map / testing / project-skills) so a user configures feature-adr
4127
+ * without knowing any schema.
4128
+ * --plan [--json] read-only: what exists / discoverable / missing (the "which docs, where?" answer)
4129
+ * --from-spec <spec.json> preview the scaffold (create / augment per file); the SKILL fills the spec
4130
+ * --apply with --from-spec: WRITE (create missing, AUGMENT existing — never clobber)
4131
+ */
4132
+ function cmdFeatureAdrSetup(options, flags, cwd, write) {
4133
+ let repoRoot = cwd;
4134
+ try {
4135
+ repoRoot = execSync('git rev-parse --show-toplevel', { cwd, encoding: 'utf-8' }).trim() || cwd;
4136
+ }
4137
+ catch { /* not git */ }
4138
+ const specPath = options.get('from-spec');
4139
+ if (specPath === undefined) {
4140
+ // default + --plan: the read-only "which documents, and where?" answer.
4141
+ const plan = buildSetupPlan(scanForSetup(repoRoot));
4142
+ if (flags.has('json')) {
4143
+ write(JSON.stringify(plan, null, 2));
4144
+ return 0;
4145
+ }
4146
+ write('feature-adr project setup — current state:');
4147
+ write(` vision.md: ${plan.exists.vision ? '✓' : '✗ missing'} manifest: ${plan.exists.manifest ? '✓' : '✗ missing'} testing.md: ${plan.exists.testing ? '✓' : '✗ missing'} project-skills.json: ${plan.exists.projectSkills ? '✓' : '✗ missing'}`);
4148
+ if (plan.discoveredPackages.length > 0)
4149
+ write(` discovered ${plan.discoveredPackages.length} workspace package(s) → a map can be auto-scaffolded`);
4150
+ if (plan.suggestions.length > 0) {
4151
+ write(' next steps:');
4152
+ for (const s of plan.suggestions)
4153
+ write(` • ${s}`);
4154
+ }
4155
+ if (plan.missing.length === 0)
4156
+ write(' all set — feature-adr is project-aware here.');
4157
+ else
4158
+ write(' → the `configure-feature-adr` skill walks you through the missing docs; or pass a filled spec with --from-spec.');
4159
+ return 0;
4160
+ }
4161
+ // --from-spec: scaffold (preview, or --apply to write).
4162
+ let spec;
4163
+ try {
4164
+ spec = JSON.parse(readFileSync(resolve(cwd, specPath), 'utf-8'));
4165
+ }
4166
+ catch (e) {
4167
+ write(`dz feature-adr-setup: cannot read spec ${specPath}: ${e instanceof Error ? e.message : String(e)}`);
4168
+ return 1;
4169
+ }
4170
+ const result = scaffoldFromSpec(spec, readExistingForScaffold(repoRoot));
4171
+ if (flags.has('json') && !flags.has('apply')) {
4172
+ write(JSON.stringify(result, null, 2));
4173
+ return 0;
4174
+ }
4175
+ write(renderScaffoldPreview(result));
4176
+ if (!flags.has('apply')) {
4177
+ write('\n(preview only — pass --apply to write)');
4178
+ return 0;
4179
+ }
4180
+ let wrote = 0;
4181
+ for (const f of result.files) {
4182
+ if (f.action === 'unchanged')
4183
+ continue; // never clobber
4184
+ const abs = resolve(repoRoot, f.path);
4185
+ // Write-boundary augment-never-clobber guard (defense in depth): a 'create' must NEVER overwrite an
4186
+ // existing file, even if the plan (built from a caller-supplied `existing`) said create. 'augment' has
4187
+ // already union-merged the prior content, so overwriting there is the merged result, not a clobber.
4188
+ if (f.action === 'create' && existsSync(abs)) {
4189
+ write(` · skipped ${f.path} — already exists (not overwritten)`);
4190
+ continue;
4191
+ }
4192
+ try {
4193
+ mkdirSync(dirname(abs), { recursive: true });
4194
+ writeFileSync(abs, f.content);
4195
+ write(` ✓ ${f.action === 'create' ? 'created' : 'augmented'} ${f.path}`);
4196
+ wrote++;
4197
+ }
4198
+ catch (e) {
4199
+ write(` ✗ ${f.path}: ${e instanceof Error ? e.message : String(e)}`);
4200
+ }
4201
+ }
4202
+ write(`\n↳ wrote ${wrote} file(s). Verify: dz project-skills + dz architecture --revise`);
4203
+ return 0;
4204
+ }
4205
+ /**
4206
+ * `dz challenge` — the deterministic "cartridge" behind the `challenge-panel` adversarial plan-gate (R6).
4207
+ * Assembles a WIDE context pack (plan + vision + testing + map + degradations) and prints the fixed C1-C8
4208
+ * "break it, don't confirm it" brief + the verdict schema. It runs NO LLM and writes nothing — the
4209
+ * `challenge-panel` SKILL fires the brief at a FRESH adversary (a model ≠ the plan author) + a mandatory
4210
+ * cross-validator. ADVISE, never block.
4211
+ * --plan <plan.md> the plan under review (required)
4212
+ * --json emit the assembled context + brief as JSON
4213
+ * --context-only just the assembled context summary (what the panel will read)
4214
+ * --author <model> the plan-author model → prints the cross-family adversary to dispatch (FR-4)
4215
+ */
4216
+ function cmdChallenge(options, flags, cwd, write) {
4217
+ let repoRoot = cwd;
4218
+ try {
4219
+ repoRoot = execSync('git rev-parse --show-toplevel', { cwd, encoding: 'utf-8' }).trim() || cwd;
4220
+ }
4221
+ catch { /* not git */ }
4222
+ const planPath = options.get('plan');
4223
+ if (planPath === undefined) {
4224
+ write('dz challenge: pass --plan <plan.md> (the implementation plan to challenge).');
4225
+ return 1;
4226
+ }
4227
+ const ctx = assembleChallengeContext(repoRoot, planPath);
4228
+ if (ctx.plan === '') {
4229
+ write(`dz challenge: plan not found or empty: ${planPath}`);
4230
+ return 1;
4231
+ }
4232
+ const adversary = pickAdversaryModel(options.get('author') ?? 'claude');
4233
+ if (flags.has('json')) {
4234
+ write(JSON.stringify({ context: ctx, brief: buildChallengeBrief(ctx), adversary, questions: CHALLENGE_QUESTIONS }, null, 2));
4235
+ return 0;
4236
+ }
4237
+ if (flags.has('context-only')) {
4238
+ const has = (v) => (v === undefined ? '✗ (less calibration)' : `✓ ${v.length} chars`);
4239
+ write(`challenge context for ${planPath}:`);
4240
+ write(` plan: ✓ ${ctx.plan.length} chars`);
4241
+ write(` vision: ${has(ctx.vision)}`);
4242
+ write(` testing: ${has(ctx.testing)}`);
4243
+ write(` map: ${has(ctx.map)}`);
4244
+ write(` degradations:${has(ctx.degradations)}`);
4245
+ write(` → adversary: ${adversary.model} — ${adversary.note}`);
4246
+ return 0;
4247
+ }
4248
+ write(buildChallengeBrief(ctx));
4249
+ write(`\n── dispatch (panel ≠ plan author) ──\n${adversary.model}: ${adversary.note}`);
4250
+ return 0;
4251
+ }
4124
4252
  function cmdStats(cwd, write) {
4125
4253
  const baseDir = join(cwd, 'packages', '@dzhechkov');
4126
4254
  if (!existsSync(baseDir)) {
@@ -4376,6 +4504,10 @@ export async function runCli(argv, io = {}) {
4376
4504
  return await cmdMrRakes(options, flags, cwd, write);
4377
4505
  case 'retro':
4378
4506
  return await cmdRetro(options, flags, cwd, write);
4507
+ case 'feature-adr-setup':
4508
+ return cmdFeatureAdrSetup(options, flags, cwd, write);
4509
+ case 'challenge':
4510
+ return cmdChallenge(options, flags, cwd, write);
4379
4511
  case 'dashboard':
4380
4512
  return cmdDashboard(cwd, write);
4381
4513
  case 'roam':