markharness

0010: Automatic project-root detection when --dir is omitted

Status

Accepted

Background

Running a markharness command without --dir operated on the current working directory rather than the root of the markharness init-ed project (Issue #9). Running an auto-generating command such as milestone from a subdirectory of the project (e.g. under knowledge/) created files in the wrong place.

This was also the issue left out of scope in 0006: “adding automatic detection of the repository root from cwd (equivalent to git rev-parse --show-toplevel) is a natural next step, but remains a separate future issue.” However, 0006 itself formally supports nested layouts where the markharness project root need not coincide with the git repository root, so git-root detection alone turned out to be insufficient.

Options considered

Mechanisms for root detection:

  1. Use the git repository root (git rev-parse --show-toplevel).
  2. Infer the root by convention, walking upward for a place where the known directory set (knowledge/ + axes/ + generated/ etc.) is present.
  3. Create a dedicated marker file at init time, and have subsequent commands search upward for it the way git does.

Decision

Option 3 was adopted.

Rationale:

The schema_version field is written but not yet read for compatibility checking; that consumer-side logic is deferred until actually needed (YAGNI).

Response taken