harness analyze-repo . --scaffold <name> --force doesn't overwrite an existing directory — it fails with the same "already exists. Pass --force to overwrite." error whether or not --force is passed.
Repro:
$ harness analyze-repo . --force --scaffold coding-harness
/path/coding-harness already exists. Pass --force to overwrite.
(--force was passed. It made no difference.)
Root cause: analyzeRepoCmd's own argument parser only recognizes a fixed set of flags:
// packages/create-agent-harness/src/analyze-repo.ts
for (let i = 0; i < args.length; i++) {
const a = args[i];
if (a === '--embed') embed = true;
else if (a === '--json') json = true;
else if (a === '--out') outDir = args[++i] ?? null;
else if (a === '--scaffold') scaffoldName = args[++i] ?? null;
else if (a === '--host') host = (args[++i] ?? 'claude-code') as Host;
else if (a && !a.startsWith('-')) dir = a;
}
There's no --force case — it's silently dropped, not even captured into a variable. Then the scaffold call never forwards a force field:
const r = await scaffold({ name: scaffoldName, template: plan.template, host, targetDir: target, description: `Harness for ${profile.name}`, generatorVersion: '0.1.0' });
ScaffoldOptions.force (index.ts:223) is left undefined, so writeAtomic(opts.targetDir, rendered, { force: opts.force }) always takes the "refuse, target exists" branch.
Contrast with the top-level metaharness <name> --force path, which works correctly: index.ts:165-166 parses --force/-f into args.force, and index.ts:752 forwards force: args.force into scaffold().
Suggested fix: add --force/-f to analyzeRepoCmd's parser and forward it into the scaffold(...) call at analyze-repo.ts:392, mirroring what index.ts already does for the top-level scaffold path.
harness analyze-repo . --scaffold <name> --forcedoesn't overwrite an existing directory — it fails with the same "already exists. Pass --force to overwrite." error whether or not--forceis passed.Repro:
(
--forcewas passed. It made no difference.)Root cause:
analyzeRepoCmd's own argument parser only recognizes a fixed set of flags:There's no
--forcecase — it's silently dropped, not even captured into a variable. Then the scaffold call never forwards aforcefield:ScaffoldOptions.force(index.ts:223) is leftundefined, sowriteAtomic(opts.targetDir, rendered, { force: opts.force })always takes the "refuse, target exists" branch.Contrast with the top-level
metaharness <name> --forcepath, which works correctly:index.ts:165-166parses--force/-fintoargs.force, andindex.ts:752forwardsforce: args.forceintoscaffold().Suggested fix: add
--force/-ftoanalyzeRepoCmd's parser and forward it into thescaffold(...)call atanalyze-repo.ts:392, mirroring whatindex.tsalready does for the top-level scaffold path.