Skip to content

feat(miner-cli): claim-ledger commands (claim / release / list) for the miner CLI #4290

Description

@JSONbored

The claim-ledger storage backend is done: packages/gittensory-miner/lib/claim-ledger.js is a real, local-only SQLite-backed CRUD store (#2314/#3351) with claimIssue(repoFullName, issueNumber, note) (lines 218-220), releaseClaim(repoFullName, issueNumber) (lines 205-207), listClaims(filter) (lines 213-215), and listActiveClaims(repoFullName) (lines 223-225) already implemented and exported, on top of openClaimLedger (line 75) which creates the miner_claims table with a UNIQUE(repo_full_name, issue_number) constraint and an atomic upsert. Nothing in the CLI calls any of it yet.

Confirmed by reading the full 110-line packages/gittensory-miner/bin/gittensory-miner.js: its dispatch is a flat sequence of if (cliArgs[0] === "<command>") blocks — init, status, doctor, manage status, queue, ledger, plan, governor, help, version, hooks check, state, manage poll — there is no claim branch anywhere. packages/gittensory-miner/lib/cli.js's printHelp (lines 5-37) likewise lists every other subcommand's usage string but not claim.

The pattern to mirror is packages/gittensory-miner/lib/portfolio-queue-cli.js: runQueueCli(subcommand, args, options) (lines 209-215) dispatches list/next/done to per-subcommand functions, each of which parses args (parseQueueListArgs etc.), opens the store via a small resource-scoping helper (withPortfolioQueue, lines 126-134 — opens a store unless the caller injected one, always closes it in a finally), and renders either a JSON blob or a human table (renderQueueTable, lines 105-124) before returning a process exit code. bin/gittensory-miner.js then wires it in with one line: if (cliArgs[0] === "queue") { process.exit(runQueueCli(cliArgs[1], cliArgs.slice(2))); } (lines 41-43).

Deliverables

  • New packages/gittensory-miner/lib/claim-ledger-cli.js exporting runClaimCli(subcommand, args, options) dispatching claim/release/list subcommands to claimIssue/releaseClaim/listClaims (or listActiveClaims) from claim-ledger.js, following the runQueueCli parse → execute → render(json|table) → exit-code convention exactly, with a withClaimLedger-style resource-scoping helper mirroring withPortfolioQueue
  • Wire it into packages/gittensory-miner/bin/gittensory-miner.js with if (cliArgs[0] === "claim") { process.exit(runClaimCli(cliArgs[1], cliArgs.slice(2))); }, mirroring the queue block at lines 41-43
  • Add usage lines to printHelp in packages/gittensory-miner/lib/cli.js (lines 5-37), e.g. gittensory-miner claim claim <owner/repo> <issue#> [--note <text>] [--json], ... claim release <owner/repo> <issue#> [--json], ... claim list [--repo <owner/repo>] [--status active|released|expired] [--json]
  • A human-readable table renderer for claim rows (repo, issue #, status, claimed-at, note), mirroring renderQueueTable (lines 105-124)
  • Tests for argument parsing and both output modes, mirroring the existing test/unit/ coverage style for portfolio-queue-cli.js

References

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

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions