terminalhire 0.40.10 → 0.40.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/jpi-claim.js +47 -25
- package/dist/bin/jpi-dispatch.js +47 -25
- package/dist/bin/jpi-mcp.js +47 -25
- package/package.json +1 -1
package/dist/bin/jpi-claim.js
CHANGED
|
@@ -27717,13 +27717,15 @@ async function cmdPreview(arg, { json } = {}) {
|
|
|
27717
27717
|
}
|
|
27718
27718
|
async function cmdList(active) {
|
|
27719
27719
|
const claims = await Promise.resolve().then(() => (init_claims(), claims_exports));
|
|
27720
|
-
|
|
27720
|
+
let list = claims.listClaims({ active });
|
|
27721
27721
|
if (list.length === 0) {
|
|
27722
27722
|
console.log(
|
|
27723
27723
|
active ? "No active claims." : "No claims yet. Use `terminalhire claim record <bountyId>`."
|
|
27724
27724
|
);
|
|
27725
27725
|
return;
|
|
27726
27726
|
}
|
|
27727
|
+
await syncFounderApprovals(claims, list);
|
|
27728
|
+
list = claims.listClaims({ active });
|
|
27727
27729
|
console.log(`
|
|
27728
27730
|
${list.length} ${active ? "active " : ""}claim${list.length === 1 ? "" : "s"}:
|
|
27729
27731
|
`);
|
|
@@ -27806,6 +27808,36 @@ async function fetchFounderApprovals(pushToken, fetchImpl = fetch) {
|
|
|
27806
27808
|
return null;
|
|
27807
27809
|
}
|
|
27808
27810
|
}
|
|
27811
|
+
async function syncFounderApprovals(claimsModule, targets) {
|
|
27812
|
+
const founderTargets = targets.filter((c) => Boolean(c.approval));
|
|
27813
|
+
let approvalsChecked = false;
|
|
27814
|
+
let approvalsUnavailable = false;
|
|
27815
|
+
let pushToken = null;
|
|
27816
|
+
if (founderTargets.length > 0) {
|
|
27817
|
+
try {
|
|
27818
|
+
pushToken = await readPushTokenEnc();
|
|
27819
|
+
} catch {
|
|
27820
|
+
pushToken = null;
|
|
27821
|
+
}
|
|
27822
|
+
if (pushToken) {
|
|
27823
|
+
const approvals = await fetchFounderApprovals(pushToken);
|
|
27824
|
+
if (approvals) {
|
|
27825
|
+
approvalsChecked = true;
|
|
27826
|
+
const approved = new Set(approvals.claimIds);
|
|
27827
|
+
for (const c of founderTargets) {
|
|
27828
|
+
if (c.approval?.claimId && c.approval.state === "pending" && approved.has(c.approval.claimId)) {
|
|
27829
|
+
claimsModule.updateClaim(c.id, {
|
|
27830
|
+
approval: { ...c.approval, state: "granted" }
|
|
27831
|
+
});
|
|
27832
|
+
}
|
|
27833
|
+
}
|
|
27834
|
+
} else {
|
|
27835
|
+
approvalsUnavailable = true;
|
|
27836
|
+
}
|
|
27837
|
+
}
|
|
27838
|
+
}
|
|
27839
|
+
return { pushToken, approvalsChecked, approvalsUnavailable };
|
|
27840
|
+
}
|
|
27809
27841
|
function founderClaimStanding(claim, approvalsChecked) {
|
|
27810
27842
|
switch (claim.state) {
|
|
27811
27843
|
case "merged":
|
|
@@ -27835,30 +27867,13 @@ async function cmdStatus(id) {
|
|
|
27835
27867
|
const founderTargets = targets.filter((c) => Boolean(c.approval));
|
|
27836
27868
|
let approvalsChecked = false;
|
|
27837
27869
|
let approvalsUnavailable = false;
|
|
27870
|
+
let pushToken = null;
|
|
27838
27871
|
if (founderTargets.length > 0) {
|
|
27839
|
-
|
|
27840
|
-
|
|
27841
|
-
|
|
27842
|
-
|
|
27843
|
-
|
|
27844
|
-
}
|
|
27845
|
-
if (pushToken) {
|
|
27846
|
-
const approvals = await fetchFounderApprovals(pushToken);
|
|
27847
|
-
if (approvals) {
|
|
27848
|
-
approvalsChecked = true;
|
|
27849
|
-
const approved = new Set(approvals.claimIds);
|
|
27850
|
-
for (const c of founderTargets) {
|
|
27851
|
-
if (c.approval?.claimId && approved.has(c.approval.claimId)) {
|
|
27852
|
-
claims.updateClaim(c.id, {
|
|
27853
|
-
approval: { ...c.approval, state: "granted" }
|
|
27854
|
-
});
|
|
27855
|
-
}
|
|
27856
|
-
}
|
|
27857
|
-
targets = id ? [claims.findClaim(id)].filter(Boolean) : claims.listClaims();
|
|
27858
|
-
} else {
|
|
27859
|
-
approvalsUnavailable = true;
|
|
27860
|
-
}
|
|
27861
|
-
}
|
|
27872
|
+
const syncRes = await syncFounderApprovals(claims, targets);
|
|
27873
|
+
pushToken = syncRes.pushToken;
|
|
27874
|
+
approvalsChecked = syncRes.approvalsChecked;
|
|
27875
|
+
approvalsUnavailable = syncRes.approvalsUnavailable;
|
|
27876
|
+
targets = id ? [claims.findClaim(id)].filter(Boolean) : claims.listClaims();
|
|
27862
27877
|
console.log("\n Founder claims:");
|
|
27863
27878
|
for (const c of targets.filter((claim) => Boolean(claim.approval))) {
|
|
27864
27879
|
console.log(` ${founderClaimStanding(c, approvalsChecked)} \u2014 ${c.title}`);
|
|
@@ -28168,6 +28183,8 @@ async function ensureForkExists(repoFullName, ghUser) {
|
|
|
28168
28183
|
async function cmdStart(id, flags = {}) {
|
|
28169
28184
|
const claims = await Promise.resolve().then(() => (init_claims(), claims_exports));
|
|
28170
28185
|
if (!id) {
|
|
28186
|
+
let list = claims.listClaims({ active: true });
|
|
28187
|
+
await syncFounderApprovals(claims, list);
|
|
28171
28188
|
const startable = claims.listClaims({ active: true }).filter((c) => c.state === "claimed");
|
|
28172
28189
|
if (startable.length === 0) {
|
|
28173
28190
|
console.log("No claims ready to start. Claim one first: terminalhire claim <ref>");
|
|
@@ -28185,11 +28202,15 @@ ${startable.length} claim${startable.length === 1 ? "" : "s"} ready to start:
|
|
|
28185
28202
|
console.log("\nRun the command under the one you want to start.");
|
|
28186
28203
|
return;
|
|
28187
28204
|
}
|
|
28188
|
-
|
|
28205
|
+
let claim = claims.findClaim(id);
|
|
28189
28206
|
if (!claim) {
|
|
28190
28207
|
console.error(`terminalhire claim: no claim with id '${id}'.`);
|
|
28191
28208
|
process.exit(1);
|
|
28192
28209
|
}
|
|
28210
|
+
if (claim.approval?.state === "pending") {
|
|
28211
|
+
await syncFounderApprovals(claims, [claim]);
|
|
28212
|
+
claim = claims.findClaim(id);
|
|
28213
|
+
}
|
|
28193
28214
|
if (claim.worktreePath) {
|
|
28194
28215
|
let stillThere = false;
|
|
28195
28216
|
try {
|
|
@@ -29876,6 +29897,7 @@ export {
|
|
|
29876
29897
|
stakeDecision,
|
|
29877
29898
|
startBranchFor,
|
|
29878
29899
|
submitRefusalFor,
|
|
29900
|
+
syncFounderApprovals,
|
|
29879
29901
|
terminalSafeInline,
|
|
29880
29902
|
terminalSafeLines,
|
|
29881
29903
|
watchRunsLoop,
|
package/dist/bin/jpi-dispatch.js
CHANGED
|
@@ -30815,6 +30815,7 @@ __export(jpi_claim_exports, {
|
|
|
30815
30815
|
stakeDecision: () => stakeDecision,
|
|
30816
30816
|
startBranchFor: () => startBranchFor,
|
|
30817
30817
|
submitRefusalFor: () => submitRefusalFor,
|
|
30818
|
+
syncFounderApprovals: () => syncFounderApprovals,
|
|
30818
30819
|
terminalSafeInline: () => terminalSafeInline,
|
|
30819
30820
|
terminalSafeLines: () => terminalSafeLines,
|
|
30820
30821
|
watchRunsLoop: () => watchRunsLoop,
|
|
@@ -32239,13 +32240,15 @@ async function cmdPreview(arg, { json } = {}) {
|
|
|
32239
32240
|
}
|
|
32240
32241
|
async function cmdList(active) {
|
|
32241
32242
|
const claims = await Promise.resolve().then(() => (init_claims(), claims_exports));
|
|
32242
|
-
|
|
32243
|
+
let list = claims.listClaims({ active });
|
|
32243
32244
|
if (list.length === 0) {
|
|
32244
32245
|
console.log(
|
|
32245
32246
|
active ? "No active claims." : "No claims yet. Use `terminalhire claim record <bountyId>`."
|
|
32246
32247
|
);
|
|
32247
32248
|
return;
|
|
32248
32249
|
}
|
|
32250
|
+
await syncFounderApprovals(claims, list);
|
|
32251
|
+
list = claims.listClaims({ active });
|
|
32249
32252
|
console.log(`
|
|
32250
32253
|
${list.length} ${active ? "active " : ""}claim${list.length === 1 ? "" : "s"}:
|
|
32251
32254
|
`);
|
|
@@ -32327,6 +32330,36 @@ async function fetchFounderApprovals(pushToken, fetchImpl = fetch) {
|
|
|
32327
32330
|
return null;
|
|
32328
32331
|
}
|
|
32329
32332
|
}
|
|
32333
|
+
async function syncFounderApprovals(claimsModule, targets) {
|
|
32334
|
+
const founderTargets = targets.filter((c) => Boolean(c.approval));
|
|
32335
|
+
let approvalsChecked = false;
|
|
32336
|
+
let approvalsUnavailable = false;
|
|
32337
|
+
let pushToken = null;
|
|
32338
|
+
if (founderTargets.length > 0) {
|
|
32339
|
+
try {
|
|
32340
|
+
pushToken = await readPushTokenEnc();
|
|
32341
|
+
} catch {
|
|
32342
|
+
pushToken = null;
|
|
32343
|
+
}
|
|
32344
|
+
if (pushToken) {
|
|
32345
|
+
const approvals = await fetchFounderApprovals(pushToken);
|
|
32346
|
+
if (approvals) {
|
|
32347
|
+
approvalsChecked = true;
|
|
32348
|
+
const approved = new Set(approvals.claimIds);
|
|
32349
|
+
for (const c of founderTargets) {
|
|
32350
|
+
if (c.approval?.claimId && c.approval.state === "pending" && approved.has(c.approval.claimId)) {
|
|
32351
|
+
claimsModule.updateClaim(c.id, {
|
|
32352
|
+
approval: { ...c.approval, state: "granted" }
|
|
32353
|
+
});
|
|
32354
|
+
}
|
|
32355
|
+
}
|
|
32356
|
+
} else {
|
|
32357
|
+
approvalsUnavailable = true;
|
|
32358
|
+
}
|
|
32359
|
+
}
|
|
32360
|
+
}
|
|
32361
|
+
return { pushToken, approvalsChecked, approvalsUnavailable };
|
|
32362
|
+
}
|
|
32330
32363
|
function founderClaimStanding(claim, approvalsChecked) {
|
|
32331
32364
|
switch (claim.state) {
|
|
32332
32365
|
case "merged":
|
|
@@ -32356,30 +32389,13 @@ async function cmdStatus(id) {
|
|
|
32356
32389
|
const founderTargets = targets.filter((c) => Boolean(c.approval));
|
|
32357
32390
|
let approvalsChecked = false;
|
|
32358
32391
|
let approvalsUnavailable = false;
|
|
32392
|
+
let pushToken = null;
|
|
32359
32393
|
if (founderTargets.length > 0) {
|
|
32360
|
-
|
|
32361
|
-
|
|
32362
|
-
|
|
32363
|
-
|
|
32364
|
-
|
|
32365
|
-
}
|
|
32366
|
-
if (pushToken) {
|
|
32367
|
-
const approvals = await fetchFounderApprovals(pushToken);
|
|
32368
|
-
if (approvals) {
|
|
32369
|
-
approvalsChecked = true;
|
|
32370
|
-
const approved = new Set(approvals.claimIds);
|
|
32371
|
-
for (const c of founderTargets) {
|
|
32372
|
-
if (c.approval?.claimId && approved.has(c.approval.claimId)) {
|
|
32373
|
-
claims.updateClaim(c.id, {
|
|
32374
|
-
approval: { ...c.approval, state: "granted" }
|
|
32375
|
-
});
|
|
32376
|
-
}
|
|
32377
|
-
}
|
|
32378
|
-
targets = id ? [claims.findClaim(id)].filter(Boolean) : claims.listClaims();
|
|
32379
|
-
} else {
|
|
32380
|
-
approvalsUnavailable = true;
|
|
32381
|
-
}
|
|
32382
|
-
}
|
|
32394
|
+
const syncRes = await syncFounderApprovals(claims, targets);
|
|
32395
|
+
pushToken = syncRes.pushToken;
|
|
32396
|
+
approvalsChecked = syncRes.approvalsChecked;
|
|
32397
|
+
approvalsUnavailable = syncRes.approvalsUnavailable;
|
|
32398
|
+
targets = id ? [claims.findClaim(id)].filter(Boolean) : claims.listClaims();
|
|
32383
32399
|
console.log("\n Founder claims:");
|
|
32384
32400
|
for (const c of targets.filter((claim) => Boolean(claim.approval))) {
|
|
32385
32401
|
console.log(` ${founderClaimStanding(c, approvalsChecked)} \u2014 ${c.title}`);
|
|
@@ -32689,6 +32705,8 @@ async function ensureForkExists(repoFullName, ghUser) {
|
|
|
32689
32705
|
async function cmdStart(id, flags = {}) {
|
|
32690
32706
|
const claims = await Promise.resolve().then(() => (init_claims(), claims_exports));
|
|
32691
32707
|
if (!id) {
|
|
32708
|
+
let list = claims.listClaims({ active: true });
|
|
32709
|
+
await syncFounderApprovals(claims, list);
|
|
32692
32710
|
const startable = claims.listClaims({ active: true }).filter((c) => c.state === "claimed");
|
|
32693
32711
|
if (startable.length === 0) {
|
|
32694
32712
|
console.log("No claims ready to start. Claim one first: terminalhire claim <ref>");
|
|
@@ -32706,11 +32724,15 @@ ${startable.length} claim${startable.length === 1 ? "" : "s"} ready to start:
|
|
|
32706
32724
|
console.log("\nRun the command under the one you want to start.");
|
|
32707
32725
|
return;
|
|
32708
32726
|
}
|
|
32709
|
-
|
|
32727
|
+
let claim = claims.findClaim(id);
|
|
32710
32728
|
if (!claim) {
|
|
32711
32729
|
console.error(`terminalhire claim: no claim with id '${id}'.`);
|
|
32712
32730
|
process.exit(1);
|
|
32713
32731
|
}
|
|
32732
|
+
if (claim.approval?.state === "pending") {
|
|
32733
|
+
await syncFounderApprovals(claims, [claim]);
|
|
32734
|
+
claim = claims.findClaim(id);
|
|
32735
|
+
}
|
|
32714
32736
|
if (claim.worktreePath) {
|
|
32715
32737
|
let stillThere = false;
|
|
32716
32738
|
try {
|
package/dist/bin/jpi-mcp.js
CHANGED
|
@@ -26349,6 +26349,7 @@ __export(jpi_claim_exports, {
|
|
|
26349
26349
|
stakeDecision: () => stakeDecision,
|
|
26350
26350
|
startBranchFor: () => startBranchFor,
|
|
26351
26351
|
submitRefusalFor: () => submitRefusalFor,
|
|
26352
|
+
syncFounderApprovals: () => syncFounderApprovals,
|
|
26352
26353
|
terminalSafeInline: () => terminalSafeInline,
|
|
26353
26354
|
terminalSafeLines: () => terminalSafeLines,
|
|
26354
26355
|
watchRunsLoop: () => watchRunsLoop,
|
|
@@ -27773,13 +27774,15 @@ async function cmdPreview(arg, { json } = {}) {
|
|
|
27773
27774
|
}
|
|
27774
27775
|
async function cmdList(active) {
|
|
27775
27776
|
const claims = await Promise.resolve().then(() => (init_claims(), claims_exports));
|
|
27776
|
-
|
|
27777
|
+
let list = claims.listClaims({ active });
|
|
27777
27778
|
if (list.length === 0) {
|
|
27778
27779
|
console.log(
|
|
27779
27780
|
active ? "No active claims." : "No claims yet. Use `terminalhire claim record <bountyId>`."
|
|
27780
27781
|
);
|
|
27781
27782
|
return;
|
|
27782
27783
|
}
|
|
27784
|
+
await syncFounderApprovals(claims, list);
|
|
27785
|
+
list = claims.listClaims({ active });
|
|
27783
27786
|
console.log(`
|
|
27784
27787
|
${list.length} ${active ? "active " : ""}claim${list.length === 1 ? "" : "s"}:
|
|
27785
27788
|
`);
|
|
@@ -27861,6 +27864,36 @@ async function fetchFounderApprovals(pushToken, fetchImpl = fetch) {
|
|
|
27861
27864
|
return null;
|
|
27862
27865
|
}
|
|
27863
27866
|
}
|
|
27867
|
+
async function syncFounderApprovals(claimsModule, targets) {
|
|
27868
|
+
const founderTargets = targets.filter((c) => Boolean(c.approval));
|
|
27869
|
+
let approvalsChecked = false;
|
|
27870
|
+
let approvalsUnavailable = false;
|
|
27871
|
+
let pushToken = null;
|
|
27872
|
+
if (founderTargets.length > 0) {
|
|
27873
|
+
try {
|
|
27874
|
+
pushToken = await readPushTokenEnc();
|
|
27875
|
+
} catch {
|
|
27876
|
+
pushToken = null;
|
|
27877
|
+
}
|
|
27878
|
+
if (pushToken) {
|
|
27879
|
+
const approvals = await fetchFounderApprovals(pushToken);
|
|
27880
|
+
if (approvals) {
|
|
27881
|
+
approvalsChecked = true;
|
|
27882
|
+
const approved = new Set(approvals.claimIds);
|
|
27883
|
+
for (const c of founderTargets) {
|
|
27884
|
+
if (c.approval?.claimId && c.approval.state === "pending" && approved.has(c.approval.claimId)) {
|
|
27885
|
+
claimsModule.updateClaim(c.id, {
|
|
27886
|
+
approval: { ...c.approval, state: "granted" }
|
|
27887
|
+
});
|
|
27888
|
+
}
|
|
27889
|
+
}
|
|
27890
|
+
} else {
|
|
27891
|
+
approvalsUnavailable = true;
|
|
27892
|
+
}
|
|
27893
|
+
}
|
|
27894
|
+
}
|
|
27895
|
+
return { pushToken, approvalsChecked, approvalsUnavailable };
|
|
27896
|
+
}
|
|
27864
27897
|
function founderClaimStanding(claim, approvalsChecked) {
|
|
27865
27898
|
switch (claim.state) {
|
|
27866
27899
|
case "merged":
|
|
@@ -27890,30 +27923,13 @@ async function cmdStatus(id) {
|
|
|
27890
27923
|
const founderTargets = targets.filter((c) => Boolean(c.approval));
|
|
27891
27924
|
let approvalsChecked = false;
|
|
27892
27925
|
let approvalsUnavailable = false;
|
|
27926
|
+
let pushToken = null;
|
|
27893
27927
|
if (founderTargets.length > 0) {
|
|
27894
|
-
|
|
27895
|
-
|
|
27896
|
-
|
|
27897
|
-
|
|
27898
|
-
|
|
27899
|
-
}
|
|
27900
|
-
if (pushToken) {
|
|
27901
|
-
const approvals = await fetchFounderApprovals(pushToken);
|
|
27902
|
-
if (approvals) {
|
|
27903
|
-
approvalsChecked = true;
|
|
27904
|
-
const approved = new Set(approvals.claimIds);
|
|
27905
|
-
for (const c of founderTargets) {
|
|
27906
|
-
if (c.approval?.claimId && approved.has(c.approval.claimId)) {
|
|
27907
|
-
claims.updateClaim(c.id, {
|
|
27908
|
-
approval: { ...c.approval, state: "granted" }
|
|
27909
|
-
});
|
|
27910
|
-
}
|
|
27911
|
-
}
|
|
27912
|
-
targets = id ? [claims.findClaim(id)].filter(Boolean) : claims.listClaims();
|
|
27913
|
-
} else {
|
|
27914
|
-
approvalsUnavailable = true;
|
|
27915
|
-
}
|
|
27916
|
-
}
|
|
27928
|
+
const syncRes = await syncFounderApprovals(claims, targets);
|
|
27929
|
+
pushToken = syncRes.pushToken;
|
|
27930
|
+
approvalsChecked = syncRes.approvalsChecked;
|
|
27931
|
+
approvalsUnavailable = syncRes.approvalsUnavailable;
|
|
27932
|
+
targets = id ? [claims.findClaim(id)].filter(Boolean) : claims.listClaims();
|
|
27917
27933
|
console.log("\n Founder claims:");
|
|
27918
27934
|
for (const c of targets.filter((claim) => Boolean(claim.approval))) {
|
|
27919
27935
|
console.log(` ${founderClaimStanding(c, approvalsChecked)} \u2014 ${c.title}`);
|
|
@@ -28223,6 +28239,8 @@ async function ensureForkExists(repoFullName, ghUser) {
|
|
|
28223
28239
|
async function cmdStart(id, flags = {}) {
|
|
28224
28240
|
const claims = await Promise.resolve().then(() => (init_claims(), claims_exports));
|
|
28225
28241
|
if (!id) {
|
|
28242
|
+
let list = claims.listClaims({ active: true });
|
|
28243
|
+
await syncFounderApprovals(claims, list);
|
|
28226
28244
|
const startable = claims.listClaims({ active: true }).filter((c) => c.state === "claimed");
|
|
28227
28245
|
if (startable.length === 0) {
|
|
28228
28246
|
console.log("No claims ready to start. Claim one first: terminalhire claim <ref>");
|
|
@@ -28240,11 +28258,15 @@ ${startable.length} claim${startable.length === 1 ? "" : "s"} ready to start:
|
|
|
28240
28258
|
console.log("\nRun the command under the one you want to start.");
|
|
28241
28259
|
return;
|
|
28242
28260
|
}
|
|
28243
|
-
|
|
28261
|
+
let claim = claims.findClaim(id);
|
|
28244
28262
|
if (!claim) {
|
|
28245
28263
|
console.error(`terminalhire claim: no claim with id '${id}'.`);
|
|
28246
28264
|
process.exit(1);
|
|
28247
28265
|
}
|
|
28266
|
+
if (claim.approval?.state === "pending") {
|
|
28267
|
+
await syncFounderApprovals(claims, [claim]);
|
|
28268
|
+
claim = claims.findClaim(id);
|
|
28269
|
+
}
|
|
28248
28270
|
if (claim.worktreePath) {
|
|
28249
28271
|
let stillThere = false;
|
|
28250
28272
|
try {
|
package/package.json
CHANGED