You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The claim-ledger storage backend is done:
packages/gittensory-miner/lib/claim-ledger.jsis a real, local-only SQLite-backed CRUD store (#2314/#3351) withclaimIssue(repoFullName, issueNumber, note)(lines 218-220),releaseClaim(repoFullName, issueNumber)(lines 205-207),listClaims(filter)(lines 213-215), andlistActiveClaims(repoFullName)(lines 223-225) already implemented and exported, on top ofopenClaimLedger(line 75) which creates theminer_claimstable with aUNIQUE(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 ofif (cliArgs[0] === "<command>")blocks —init,status,doctor,manage status,queue,ledger,plan,governor,help,version,hooks check,state,manage poll— there is noclaimbranch anywhere.packages/gittensory-miner/lib/cli.js'sprintHelp(lines 5-37) likewise lists every other subcommand's usage string but notclaim.The pattern to mirror is
packages/gittensory-miner/lib/portfolio-queue-cli.js:runQueueCli(subcommand, args, options)(lines 209-215) dispatcheslist/next/doneto per-subcommand functions, each of which parses args (parseQueueListArgsetc.), 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 afinally), and renders either a JSON blob or a human table (renderQueueTable, lines 105-124) before returning a process exit code.bin/gittensory-miner.jsthen wires it in with one line:if (cliArgs[0] === "queue") { process.exit(runQueueCli(cliArgs[1], cliArgs.slice(2))); }(lines 41-43).Deliverables
packages/gittensory-miner/lib/claim-ledger-cli.jsexportingrunClaimCli(subcommand, args, options)dispatchingclaim/release/listsubcommands toclaimIssue/releaseClaim/listClaims(orlistActiveClaims) fromclaim-ledger.js, following therunQueueCliparse → execute → render(json|table) → exit-code convention exactly, with awithClaimLedger-style resource-scoping helper mirroringwithPortfolioQueuepackages/gittensory-miner/bin/gittensory-miner.jswithif (cliArgs[0] === "claim") { process.exit(runClaimCli(cliArgs[1], cliArgs.slice(2))); }, mirroring thequeueblock at lines 41-43printHelpinpackages/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]renderQueueTable(lines 105-124)test/unit/coverage style forportfolio-queue-cli.jsReferences
packages/gittensory-miner/lib/claim-ledger.js:75(openClaimLedger)packages/gittensory-miner/lib/claim-ledger.js:218-220(claimIssue)packages/gittensory-miner/lib/claim-ledger.js:205-207(releaseClaim)packages/gittensory-miner/lib/claim-ledger.js:213-215(listClaims)packages/gittensory-miner/lib/claim-ledger.js:223-225(listActiveClaims)packages/gittensory-miner/lib/claim-ledger.js:12(CLAIM_STATUSES)packages/gittensory-miner/lib/portfolio-queue-cli.js:105-124(renderQueueTable, table-rendering pattern)packages/gittensory-miner/lib/portfolio-queue-cli.js:126-134(withPortfolioQueue, resource-scoping pattern)packages/gittensory-miner/lib/portfolio-queue-cli.js:209-215(runQueueCli, dispatch pattern)packages/gittensory-miner/bin/gittensory-miner.js:41-43(wiring pattern to mirror)packages/gittensory-miner/lib/cli.js:5-37(printHelp, needs new usage lines)claim-ledgermodule exposingclaimIssue(repoFullName, issueNumber): ClaimEntry,releaseClaim(repoFullName, issueNumber),listActiveClaims(repoFullName?). #3351-Doc comment explicitly noting this table is a LOCAL bookkeeping primitive only and does NOT itself decide who "wins" a contested issue — that adjudication (reusingisDuplicateClusterWinnerByClaimfrom@jsonbored/gittensory-engine) is out of scope for this foundation-phase issue. #3355 for the storage backend's own history)