Skip to content

feat(miner-foundation): MinerGoalSpec parser mirroring focus-manifest's parse pattern #2294

Description

@JSONbored

Implement parseMinerGoalSpec(raw: unknown, source?) / parseMinerGoalSpecContent(content: string | null | undefined) following the EXACT same shape as src/signals/focus-manifest.ts's parseFocusManifest/parseFocusManifestContent: tolerant of a missing file (returns DEFAULT_MINER_GOAL_SPEC), tolerant of unknown/malformed keys (drops them with a warning, never throws), validates each field against its declared type/enum and falls back to the default on a type mismatch, and returns a warnings: string[] array alongside the parsed spec so a CLI can surface "your .gittensory-miner.yml had problems" without hard-failing the miner run.

Deliverables

  • parseMinerGoalSpec(raw: unknown, source?: "repo_file" | "user_supplied") and parseMinerGoalSpecContent(content: string | null | undefined) implementing YAML-then-JSON fallback parsing (mirror parseFocusManifestContent's try-YAML-then-JSON approach) and per-field validation with warnings-not-throws on any single bad field.
  • File-discovery order documented and implemented: .gittensory-miner.yml.github/gittensory-miner.yml.gittensory-miner.json.github/gittensory-miner.json, first match wins (mirroring .gittensory.yml's own documented discovery order).
  • gittensory-miner status (from the earlier CLI-entry-point issue) gains a line reporting whether a goal-spec file was found and any parse warnings, wiring this parser into the CLI end-to-end.
  • Unit tests: no file present → defaults; valid file → every field round-trips; each field independently malformed → falls back to its own default with a warning (not the whole spec falling back); unknown top-level key → dropped silently, no warning needed (matches focus-manifest's own tolerance for genuinely unknown keys vs. known-but-malformed ones — confirm which convention focus-manifest.ts actually uses and match it exactly, citing the specific line).
  • .gittensory-miner.yml.example documentation file at the repo root, matching the header-comment style and per-field "Default: X" convention of .gittensory.yml.example.

References

  • src/signals/focus-manifest.ts parseFocusManifest/parseFocusManifestContent (lines 995-1142) — THE pattern to mirror, per the phase brief's explicit instruction.
  • .gittensory.yml.example (full file, 10679 bytes) — the doc-comment style/structure to mirror for the new .gittensory-miner.yml.example.
  • packages/gittensory-engine/src/miner-goal-spec.ts (or wherever the sibling types issue placed it) — the type contract this parser fills.

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:featureGittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.help wantedExtra attention is needed

    Projects

    Status
    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions