terminalhire 0.42.0 → 0.42.1
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/claim-push-bg.js +19 -2
- package/dist/bin/jpi-bounties.js +19 -2
- package/dist/bin/jpi-claim.js +36 -11
- package/dist/bin/jpi-contribute.js +19 -2
- package/dist/bin/jpi-dispatch.js +37 -12
- package/dist/bin/jpi-hub.js +19 -2
- package/dist/bin/jpi-mcp.js +37 -12
- package/dist/bin/jpi-refresh.js +19 -2
- package/dist/bin/jpi-repo.js +19 -2
- package/dist/src/claims.js +18 -1
- package/package.json +1 -1
|
@@ -166,8 +166,24 @@ function nextPolledState(from, observed) {
|
|
|
166
166
|
function nowISO() {
|
|
167
167
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
168
168
|
}
|
|
169
|
+
function defangText(s) {
|
|
170
|
+
return typeof s === "string" ? s.replace(CONTROL_CHARS, "") : s;
|
|
171
|
+
}
|
|
172
|
+
function finiteAmount(a) {
|
|
173
|
+
if (typeof a === "number") return Number.isFinite(a) ? a : null;
|
|
174
|
+
if (typeof a !== "string" || a.trim() === "") return null;
|
|
175
|
+
const n = Number(a);
|
|
176
|
+
return Number.isFinite(n) ? n : null;
|
|
177
|
+
}
|
|
169
178
|
function normalizeClaim(c) {
|
|
170
|
-
return {
|
|
179
|
+
return {
|
|
180
|
+
...c,
|
|
181
|
+
kind: c.kind ?? "bounty",
|
|
182
|
+
policy: c.policy ?? null,
|
|
183
|
+
title: defangText(c.title),
|
|
184
|
+
repoFullName: defangText(c.repoFullName),
|
|
185
|
+
amountUSD: finiteAmount(c.amountUSD)
|
|
186
|
+
};
|
|
171
187
|
}
|
|
172
188
|
function readClaims() {
|
|
173
189
|
try {
|
|
@@ -289,7 +305,7 @@ function acceptedPRRate(claims = readClaims()) {
|
|
|
289
305
|
const merged = claims.filter((c) => c.state === "merged").length;
|
|
290
306
|
return { merged, total, rate: total === 0 ? 0 : merged / total };
|
|
291
307
|
}
|
|
292
|
-
var TERMINALHIRE_DIR3, CLAIMS_FILE, LOCK_DIR, LOCK_STALE_MS, LOCK_RETRY_MS, LOCK_TIMEOUT_MS, CLAIM_STATES, PUSHED_CLAIM_FIELDS, TERMINAL_STATES, POLL_TRANSITIONS;
|
|
308
|
+
var TERMINALHIRE_DIR3, CLAIMS_FILE, LOCK_DIR, LOCK_STALE_MS, LOCK_RETRY_MS, LOCK_TIMEOUT_MS, CLAIM_STATES, PUSHED_CLAIM_FIELDS, TERMINAL_STATES, POLL_TRANSITIONS, CONTROL_CHARS;
|
|
293
309
|
var init_claims = __esm({
|
|
294
310
|
"src/claims.ts"() {
|
|
295
311
|
"use strict";
|
|
@@ -345,6 +361,7 @@ var init_claims = __esm({
|
|
|
345
361
|
]),
|
|
346
362
|
submitted: /* @__PURE__ */ new Set(["claimed", "working", "in-review", "ready"])
|
|
347
363
|
};
|
|
364
|
+
CONTROL_CHARS = /[\x00-\x1f\x7f-\x9f]/g;
|
|
348
365
|
}
|
|
349
366
|
});
|
|
350
367
|
|
package/dist/bin/jpi-bounties.js
CHANGED
|
@@ -11338,8 +11338,24 @@ function nextPolledState(from, observed) {
|
|
|
11338
11338
|
function nowISO2() {
|
|
11339
11339
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
11340
11340
|
}
|
|
11341
|
+
function defangText(s) {
|
|
11342
|
+
return typeof s === "string" ? s.replace(CONTROL_CHARS2, "") : s;
|
|
11343
|
+
}
|
|
11344
|
+
function finiteAmount(a) {
|
|
11345
|
+
if (typeof a === "number") return Number.isFinite(a) ? a : null;
|
|
11346
|
+
if (typeof a !== "string" || a.trim() === "") return null;
|
|
11347
|
+
const n = Number(a);
|
|
11348
|
+
return Number.isFinite(n) ? n : null;
|
|
11349
|
+
}
|
|
11341
11350
|
function normalizeClaim(c) {
|
|
11342
|
-
return {
|
|
11351
|
+
return {
|
|
11352
|
+
...c,
|
|
11353
|
+
kind: c.kind ?? "bounty",
|
|
11354
|
+
policy: c.policy ?? null,
|
|
11355
|
+
title: defangText(c.title),
|
|
11356
|
+
repoFullName: defangText(c.repoFullName),
|
|
11357
|
+
amountUSD: finiteAmount(c.amountUSD)
|
|
11358
|
+
};
|
|
11343
11359
|
}
|
|
11344
11360
|
function readClaims() {
|
|
11345
11361
|
try {
|
|
@@ -11461,7 +11477,7 @@ function acceptedPRRate(claims = readClaims()) {
|
|
|
11461
11477
|
const merged = claims.filter((c) => c.state === "merged").length;
|
|
11462
11478
|
return { merged, total, rate: total === 0 ? 0 : merged / total };
|
|
11463
11479
|
}
|
|
11464
|
-
var TERMINALHIRE_DIR5, CLAIMS_FILE, LOCK_DIR, LOCK_STALE_MS, LOCK_RETRY_MS, LOCK_TIMEOUT_MS, CLAIM_STATES, PUSHED_CLAIM_FIELDS, TERMINAL_STATES, POLL_TRANSITIONS;
|
|
11480
|
+
var TERMINALHIRE_DIR5, CLAIMS_FILE, LOCK_DIR, LOCK_STALE_MS, LOCK_RETRY_MS, LOCK_TIMEOUT_MS, CLAIM_STATES, PUSHED_CLAIM_FIELDS, TERMINAL_STATES, POLL_TRANSITIONS, CONTROL_CHARS2;
|
|
11465
11481
|
var init_claims = __esm({
|
|
11466
11482
|
"src/claims.ts"() {
|
|
11467
11483
|
"use strict";
|
|
@@ -11517,6 +11533,7 @@ var init_claims = __esm({
|
|
|
11517
11533
|
]),
|
|
11518
11534
|
submitted: /* @__PURE__ */ new Set(["claimed", "working", "in-review", "ready"])
|
|
11519
11535
|
};
|
|
11536
|
+
CONTROL_CHARS2 = /[\x00-\x1f\x7f-\x9f]/g;
|
|
11520
11537
|
}
|
|
11521
11538
|
});
|
|
11522
11539
|
|
package/dist/bin/jpi-claim.js
CHANGED
|
@@ -10638,8 +10638,24 @@ function nextPolledState(from, observed) {
|
|
|
10638
10638
|
function nowISO() {
|
|
10639
10639
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
10640
10640
|
}
|
|
10641
|
+
function defangText(s) {
|
|
10642
|
+
return typeof s === "string" ? s.replace(CONTROL_CHARS2, "") : s;
|
|
10643
|
+
}
|
|
10644
|
+
function finiteAmount(a) {
|
|
10645
|
+
if (typeof a === "number") return Number.isFinite(a) ? a : null;
|
|
10646
|
+
if (typeof a !== "string" || a.trim() === "") return null;
|
|
10647
|
+
const n = Number(a);
|
|
10648
|
+
return Number.isFinite(n) ? n : null;
|
|
10649
|
+
}
|
|
10641
10650
|
function normalizeClaim(c) {
|
|
10642
|
-
return {
|
|
10651
|
+
return {
|
|
10652
|
+
...c,
|
|
10653
|
+
kind: c.kind ?? "bounty",
|
|
10654
|
+
policy: c.policy ?? null,
|
|
10655
|
+
title: defangText(c.title),
|
|
10656
|
+
repoFullName: defangText(c.repoFullName),
|
|
10657
|
+
amountUSD: finiteAmount(c.amountUSD)
|
|
10658
|
+
};
|
|
10643
10659
|
}
|
|
10644
10660
|
function readClaims() {
|
|
10645
10661
|
try {
|
|
@@ -10761,7 +10777,7 @@ function acceptedPRRate(claims = readClaims()) {
|
|
|
10761
10777
|
const merged = claims.filter((c) => c.state === "merged").length;
|
|
10762
10778
|
return { merged, total, rate: total === 0 ? 0 : merged / total };
|
|
10763
10779
|
}
|
|
10764
|
-
var TERMINALHIRE_DIR2, CLAIMS_FILE, LOCK_DIR, LOCK_STALE_MS, LOCK_RETRY_MS, LOCK_TIMEOUT_MS, CLAIM_STATES, PUSHED_CLAIM_FIELDS, TERMINAL_STATES, POLL_TRANSITIONS;
|
|
10780
|
+
var TERMINALHIRE_DIR2, CLAIMS_FILE, LOCK_DIR, LOCK_STALE_MS, LOCK_RETRY_MS, LOCK_TIMEOUT_MS, CLAIM_STATES, PUSHED_CLAIM_FIELDS, TERMINAL_STATES, POLL_TRANSITIONS, CONTROL_CHARS2;
|
|
10765
10781
|
var init_claims = __esm({
|
|
10766
10782
|
"src/claims.ts"() {
|
|
10767
10783
|
"use strict";
|
|
@@ -10817,6 +10833,7 @@ var init_claims = __esm({
|
|
|
10817
10833
|
]),
|
|
10818
10834
|
submitted: /* @__PURE__ */ new Set(["claimed", "working", "in-review", "ready"])
|
|
10819
10835
|
};
|
|
10836
|
+
CONTROL_CHARS2 = /[\x00-\x1f\x7f-\x9f]/g;
|
|
10820
10837
|
}
|
|
10821
10838
|
});
|
|
10822
10839
|
|
|
@@ -27064,7 +27081,10 @@ async function pollPR(prUrl) {
|
|
|
27064
27081
|
}
|
|
27065
27082
|
}
|
|
27066
27083
|
function fmtAmount(a) {
|
|
27067
|
-
|
|
27084
|
+
if (a == null) return "$\u2014";
|
|
27085
|
+
if (typeof a === "string" && a.trim() === "") return "$\u2014";
|
|
27086
|
+
const n = typeof a === "number" ? a : Number(a);
|
|
27087
|
+
return Number.isFinite(n) ? "$" + n.toLocaleString() : "$\u2014";
|
|
27068
27088
|
}
|
|
27069
27089
|
function fmtClaimAmount(c) {
|
|
27070
27090
|
return c.kind === "contribution" ? "contribution" : fmtAmount(c.amountUSD);
|
|
@@ -28402,7 +28422,7 @@ function startableRow(c) {
|
|
|
28402
28422
|
}
|
|
28403
28423
|
async function pickStartableClaim(claims, { prompt = ask, isTTY = process.stdin.isTTY } = {}) {
|
|
28404
28424
|
const active = claims.listClaims({ active: true });
|
|
28405
|
-
await syncFounderApprovals(claims, active);
|
|
28425
|
+
const { approvalsChecked, approvalsUnavailable } = await syncFounderApprovals(claims, active);
|
|
28406
28426
|
const startable = claims.listClaims({ active: true }).filter((c) => c.state === "claimed");
|
|
28407
28427
|
if (startable.length === 0) {
|
|
28408
28428
|
console.log("No claims ready to start. Claim one first: terminalhire claim <ref>");
|
|
@@ -28430,23 +28450,24 @@ Which one? (1-${startable.length}, or q to quit) `);
|
|
|
28430
28450
|
Nothing started \u2014 '${answer}' is not one of 1-${startable.length}.`);
|
|
28431
28451
|
return null;
|
|
28432
28452
|
}
|
|
28433
|
-
return startable[n - 1].id;
|
|
28453
|
+
return { id: startable[n - 1].id, approvalsChecked, approvalsUnavailable };
|
|
28434
28454
|
}
|
|
28435
28455
|
async function cmdStart(id, flags = {}) {
|
|
28436
28456
|
const claims = await Promise.resolve().then(() => (init_claims(), claims_exports));
|
|
28457
|
+
let approvalsChecked = false;
|
|
28458
|
+
let approvalsUnavailable = false;
|
|
28437
28459
|
if (!id) {
|
|
28438
28460
|
const picked = await pickStartableClaim(claims);
|
|
28439
28461
|
if (!picked) return;
|
|
28440
|
-
id = picked;
|
|
28462
|
+
({ id, approvalsChecked, approvalsUnavailable } = picked);
|
|
28441
28463
|
}
|
|
28442
28464
|
let claim = claims.findClaim(id);
|
|
28443
28465
|
if (!claim) {
|
|
28444
28466
|
console.error(`terminalhire claim: no claim with id '${id}'.`);
|
|
28445
28467
|
process.exit(1);
|
|
28446
28468
|
}
|
|
28447
|
-
|
|
28448
|
-
|
|
28449
|
-
({ approvalsChecked } = await syncFounderApprovals(claims, [claim]));
|
|
28469
|
+
if (claim.approval?.state === "pending" && !approvalsChecked) {
|
|
28470
|
+
({ approvalsChecked, approvalsUnavailable } = await syncFounderApprovals(claims, [claim]));
|
|
28450
28471
|
claim = claims.findClaim(id);
|
|
28451
28472
|
}
|
|
28452
28473
|
if (claim.worktreePath) {
|
|
@@ -28473,6 +28494,10 @@ ${sanitizeText(claim.title)}`);
|
|
|
28473
28494
|
console.log(" same way.");
|
|
28474
28495
|
if (shouldStatePending(claim, approvalsChecked)) {
|
|
28475
28496
|
console.log("\n Access is pending \u2014 the founder has not approved your claim yet.");
|
|
28497
|
+
} else if (approvalsUnavailable) {
|
|
28498
|
+
console.log(
|
|
28499
|
+
"\n Terminalhire could not check approvals right now; local state was preserved.\n The next step below still works \u2014 it asks the server directly."
|
|
28500
|
+
);
|
|
28476
28501
|
}
|
|
28477
28502
|
printNextSteps([claim]);
|
|
28478
28503
|
return;
|
|
@@ -28724,10 +28749,10 @@ var CLAIM_EVENT_LABEL = {
|
|
|
28724
28749
|
rejected: "the founder rejected"
|
|
28725
28750
|
};
|
|
28726
28751
|
var LINE_BREAKS = /\r\n|[\r\n\v\f\u0085\u2028\u2029]/;
|
|
28727
|
-
var
|
|
28752
|
+
var CONTROL_CHARS3 = /[\u0000-\u001F\u007F-\u009F]/g;
|
|
28728
28753
|
function terminalSafeLines(raw) {
|
|
28729
28754
|
if (typeof raw !== "string" || raw === "") return [];
|
|
28730
|
-
return raw.split(LINE_BREAKS).map((l) => l.replace(
|
|
28755
|
+
return raw.split(LINE_BREAKS).map((l) => l.replace(CONTROL_CHARS3, ""));
|
|
28731
28756
|
}
|
|
28732
28757
|
function terminalSafeInline(raw) {
|
|
28733
28758
|
return terminalSafeLines(raw).join(" ");
|
|
@@ -3617,8 +3617,24 @@ function nextPolledState(from, observed) {
|
|
|
3617
3617
|
function nowISO2() {
|
|
3618
3618
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
3619
3619
|
}
|
|
3620
|
+
function defangText(s) {
|
|
3621
|
+
return typeof s === "string" ? s.replace(CONTROL_CHARS2, "") : s;
|
|
3622
|
+
}
|
|
3623
|
+
function finiteAmount(a) {
|
|
3624
|
+
if (typeof a === "number") return Number.isFinite(a) ? a : null;
|
|
3625
|
+
if (typeof a !== "string" || a.trim() === "") return null;
|
|
3626
|
+
const n = Number(a);
|
|
3627
|
+
return Number.isFinite(n) ? n : null;
|
|
3628
|
+
}
|
|
3620
3629
|
function normalizeClaim(c) {
|
|
3621
|
-
return {
|
|
3630
|
+
return {
|
|
3631
|
+
...c,
|
|
3632
|
+
kind: c.kind ?? "bounty",
|
|
3633
|
+
policy: c.policy ?? null,
|
|
3634
|
+
title: defangText(c.title),
|
|
3635
|
+
repoFullName: defangText(c.repoFullName),
|
|
3636
|
+
amountUSD: finiteAmount(c.amountUSD)
|
|
3637
|
+
};
|
|
3622
3638
|
}
|
|
3623
3639
|
function readClaims() {
|
|
3624
3640
|
try {
|
|
@@ -3740,7 +3756,7 @@ function acceptedPRRate(claims = readClaims()) {
|
|
|
3740
3756
|
const merged = claims.filter((c) => c.state === "merged").length;
|
|
3741
3757
|
return { merged, total, rate: total === 0 ? 0 : merged / total };
|
|
3742
3758
|
}
|
|
3743
|
-
var TERMINALHIRE_DIR7, CLAIMS_FILE, LOCK_DIR, LOCK_STALE_MS, LOCK_RETRY_MS, LOCK_TIMEOUT_MS, CLAIM_STATES, PUSHED_CLAIM_FIELDS, TERMINAL_STATES, POLL_TRANSITIONS;
|
|
3759
|
+
var TERMINALHIRE_DIR7, CLAIMS_FILE, LOCK_DIR, LOCK_STALE_MS, LOCK_RETRY_MS, LOCK_TIMEOUT_MS, CLAIM_STATES, PUSHED_CLAIM_FIELDS, TERMINAL_STATES, POLL_TRANSITIONS, CONTROL_CHARS2;
|
|
3744
3760
|
var init_claims = __esm({
|
|
3745
3761
|
"src/claims.ts"() {
|
|
3746
3762
|
"use strict";
|
|
@@ -3796,6 +3812,7 @@ var init_claims = __esm({
|
|
|
3796
3812
|
]),
|
|
3797
3813
|
submitted: /* @__PURE__ */ new Set(["claimed", "working", "in-review", "ready"])
|
|
3798
3814
|
};
|
|
3815
|
+
CONTROL_CHARS2 = /[\x00-\x1f\x7f-\x9f]/g;
|
|
3799
3816
|
}
|
|
3800
3817
|
});
|
|
3801
3818
|
|
package/dist/bin/jpi-dispatch.js
CHANGED
|
@@ -15181,8 +15181,24 @@ function nextPolledState(from, observed) {
|
|
|
15181
15181
|
function nowISO2() {
|
|
15182
15182
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
15183
15183
|
}
|
|
15184
|
+
function defangText(s) {
|
|
15185
|
+
return typeof s === "string" ? s.replace(CONTROL_CHARS2, "") : s;
|
|
15186
|
+
}
|
|
15187
|
+
function finiteAmount(a) {
|
|
15188
|
+
if (typeof a === "number") return Number.isFinite(a) ? a : null;
|
|
15189
|
+
if (typeof a !== "string" || a.trim() === "") return null;
|
|
15190
|
+
const n = Number(a);
|
|
15191
|
+
return Number.isFinite(n) ? n : null;
|
|
15192
|
+
}
|
|
15184
15193
|
function normalizeClaim(c) {
|
|
15185
|
-
return {
|
|
15194
|
+
return {
|
|
15195
|
+
...c,
|
|
15196
|
+
kind: c.kind ?? "bounty",
|
|
15197
|
+
policy: c.policy ?? null,
|
|
15198
|
+
title: defangText(c.title),
|
|
15199
|
+
repoFullName: defangText(c.repoFullName),
|
|
15200
|
+
amountUSD: finiteAmount(c.amountUSD)
|
|
15201
|
+
};
|
|
15186
15202
|
}
|
|
15187
15203
|
function readClaims() {
|
|
15188
15204
|
try {
|
|
@@ -15304,7 +15320,7 @@ function acceptedPRRate(claims = readClaims()) {
|
|
|
15304
15320
|
const merged = claims.filter((c) => c.state === "merged").length;
|
|
15305
15321
|
return { merged, total, rate: total === 0 ? 0 : merged / total };
|
|
15306
15322
|
}
|
|
15307
|
-
var TERMINALHIRE_DIR11, CLAIMS_FILE, LOCK_DIR, LOCK_STALE_MS2, LOCK_RETRY_MS, LOCK_TIMEOUT_MS, CLAIM_STATES, PUSHED_CLAIM_FIELDS, TERMINAL_STATES, POLL_TRANSITIONS;
|
|
15323
|
+
var TERMINALHIRE_DIR11, CLAIMS_FILE, LOCK_DIR, LOCK_STALE_MS2, LOCK_RETRY_MS, LOCK_TIMEOUT_MS, CLAIM_STATES, PUSHED_CLAIM_FIELDS, TERMINAL_STATES, POLL_TRANSITIONS, CONTROL_CHARS2;
|
|
15308
15324
|
var init_claims = __esm({
|
|
15309
15325
|
"src/claims.ts"() {
|
|
15310
15326
|
"use strict";
|
|
@@ -15360,6 +15376,7 @@ var init_claims = __esm({
|
|
|
15360
15376
|
]),
|
|
15361
15377
|
submitted: /* @__PURE__ */ new Set(["claimed", "working", "in-review", "ready"])
|
|
15362
15378
|
};
|
|
15379
|
+
CONTROL_CHARS2 = /[\x00-\x1f\x7f-\x9f]/g;
|
|
15363
15380
|
}
|
|
15364
15381
|
});
|
|
15365
15382
|
|
|
@@ -31662,7 +31679,10 @@ async function pollPR(prUrl) {
|
|
|
31662
31679
|
}
|
|
31663
31680
|
}
|
|
31664
31681
|
function fmtAmount(a) {
|
|
31665
|
-
|
|
31682
|
+
if (a == null) return "$\u2014";
|
|
31683
|
+
if (typeof a === "string" && a.trim() === "") return "$\u2014";
|
|
31684
|
+
const n = typeof a === "number" ? a : Number(a);
|
|
31685
|
+
return Number.isFinite(n) ? "$" + n.toLocaleString() : "$\u2014";
|
|
31666
31686
|
}
|
|
31667
31687
|
function fmtClaimAmount(c) {
|
|
31668
31688
|
return c.kind === "contribution" ? "contribution" : fmtAmount(c.amountUSD);
|
|
@@ -32979,7 +32999,7 @@ function startableRow(c) {
|
|
|
32979
32999
|
}
|
|
32980
33000
|
async function pickStartableClaim(claims, { prompt: prompt5 = ask, isTTY = process.stdin.isTTY } = {}) {
|
|
32981
33001
|
const active = claims.listClaims({ active: true });
|
|
32982
|
-
await syncFounderApprovals(claims, active);
|
|
33002
|
+
const { approvalsChecked, approvalsUnavailable } = await syncFounderApprovals(claims, active);
|
|
32983
33003
|
const startable = claims.listClaims({ active: true }).filter((c) => c.state === "claimed");
|
|
32984
33004
|
if (startable.length === 0) {
|
|
32985
33005
|
console.log("No claims ready to start. Claim one first: terminalhire claim <ref>");
|
|
@@ -33007,23 +33027,24 @@ Which one? (1-${startable.length}, or q to quit) `);
|
|
|
33007
33027
|
Nothing started \u2014 '${answer}' is not one of 1-${startable.length}.`);
|
|
33008
33028
|
return null;
|
|
33009
33029
|
}
|
|
33010
|
-
return startable[n - 1].id;
|
|
33030
|
+
return { id: startable[n - 1].id, approvalsChecked, approvalsUnavailable };
|
|
33011
33031
|
}
|
|
33012
33032
|
async function cmdStart(id, flags = {}) {
|
|
33013
33033
|
const claims = await Promise.resolve().then(() => (init_claims(), claims_exports));
|
|
33034
|
+
let approvalsChecked = false;
|
|
33035
|
+
let approvalsUnavailable = false;
|
|
33014
33036
|
if (!id) {
|
|
33015
33037
|
const picked = await pickStartableClaim(claims);
|
|
33016
33038
|
if (!picked) return;
|
|
33017
|
-
id = picked;
|
|
33039
|
+
({ id, approvalsChecked, approvalsUnavailable } = picked);
|
|
33018
33040
|
}
|
|
33019
33041
|
let claim = claims.findClaim(id);
|
|
33020
33042
|
if (!claim) {
|
|
33021
33043
|
console.error(`terminalhire claim: no claim with id '${id}'.`);
|
|
33022
33044
|
process.exit(1);
|
|
33023
33045
|
}
|
|
33024
|
-
|
|
33025
|
-
|
|
33026
|
-
({ approvalsChecked } = await syncFounderApprovals(claims, [claim]));
|
|
33046
|
+
if (claim.approval?.state === "pending" && !approvalsChecked) {
|
|
33047
|
+
({ approvalsChecked, approvalsUnavailable } = await syncFounderApprovals(claims, [claim]));
|
|
33027
33048
|
claim = claims.findClaim(id);
|
|
33028
33049
|
}
|
|
33029
33050
|
if (claim.worktreePath) {
|
|
@@ -33050,6 +33071,10 @@ ${sanitizeText(claim.title)}`);
|
|
|
33050
33071
|
console.log(" same way.");
|
|
33051
33072
|
if (shouldStatePending(claim, approvalsChecked)) {
|
|
33052
33073
|
console.log("\n Access is pending \u2014 the founder has not approved your claim yet.");
|
|
33074
|
+
} else if (approvalsUnavailable) {
|
|
33075
|
+
console.log(
|
|
33076
|
+
"\n Terminalhire could not check approvals right now; local state was preserved.\n The next step below still works \u2014 it asks the server directly."
|
|
33077
|
+
);
|
|
33053
33078
|
}
|
|
33054
33079
|
printNextSteps([claim]);
|
|
33055
33080
|
return;
|
|
@@ -33289,7 +33314,7 @@ function renderRunView(run32, message) {
|
|
|
33289
33314
|
}
|
|
33290
33315
|
function terminalSafeLines(raw) {
|
|
33291
33316
|
if (typeof raw !== "string" || raw === "") return [];
|
|
33292
|
-
return raw.split(LINE_BREAKS).map((l) => l.replace(
|
|
33317
|
+
return raw.split(LINE_BREAKS).map((l) => l.replace(CONTROL_CHARS3, ""));
|
|
33293
33318
|
}
|
|
33294
33319
|
function terminalSafeInline(raw) {
|
|
33295
33320
|
return terminalSafeLines(raw).join(" ");
|
|
@@ -34740,7 +34765,7 @@ async function run7() {
|
|
|
34740
34765
|
process.exit(1);
|
|
34741
34766
|
}
|
|
34742
34767
|
}
|
|
34743
|
-
var TERMINALHIRE_DIR17, INDEX_CACHE_FILE5, CLAIM_PUSH_MARKER, REPO_CONTINUITY_NUDGE_MARKER, API_URL6, CLAIM_SYNC_BASE4, CLAIM_CONSENT_VERSION, CLAIM_POLL_INTERVAL_MS, CLAIM_POLL_TIMEOUT_MS, GH_API3, GH_HEADERS2, CONTENTION_HINT, AI_DISCLOSURE_NOTE, pExecFile, VALUE_FLAGS, ASSIGNMENT_MARKER, STAKE_MARKER, STANDDOWN_MARKER, OUR_MARKERS, STAKE_POST_TIMEOUT_MS, STAKE_POSTING_GRACE_MS, TAKE_BOT_REPOS, SUBMIT_ACCEPTS, REVISE_RECOVERY_STATES, PUSH_TOKEN_REFUSAL, SYNC_BACKGROUND_PUSH_ACTIVE_FIELD, ISSUE_OUTCOME_TERMINAL, RUNS_POLL_INTERVAL_MS, RUNS_POLL_ATTEMPTS, CLAIM_EVENT_LABEL, LINE_BREAKS,
|
|
34768
|
+
var TERMINALHIRE_DIR17, INDEX_CACHE_FILE5, CLAIM_PUSH_MARKER, REPO_CONTINUITY_NUDGE_MARKER, API_URL6, CLAIM_SYNC_BASE4, CLAIM_CONSENT_VERSION, CLAIM_POLL_INTERVAL_MS, CLAIM_POLL_TIMEOUT_MS, GH_API3, GH_HEADERS2, CONTENTION_HINT, AI_DISCLOSURE_NOTE, pExecFile, VALUE_FLAGS, ASSIGNMENT_MARKER, STAKE_MARKER, STANDDOWN_MARKER, OUR_MARKERS, STAKE_POST_TIMEOUT_MS, STAKE_POSTING_GRACE_MS, TAKE_BOT_REPOS, SUBMIT_ACCEPTS, REVISE_RECOVERY_STATES, PUSH_TOKEN_REFUSAL, SYNC_BACKGROUND_PUSH_ACTIVE_FIELD, ISSUE_OUTCOME_TERMINAL, RUNS_POLL_INTERVAL_MS, RUNS_POLL_ATTEMPTS, CLAIM_EVENT_LABEL, LINE_BREAKS, CONTROL_CHARS3;
|
|
34744
34769
|
var init_jpi_claim = __esm({
|
|
34745
34770
|
"bin/jpi-claim.js"() {
|
|
34746
34771
|
"use strict";
|
|
@@ -34810,7 +34835,7 @@ var init_jpi_claim = __esm({
|
|
|
34810
34835
|
rejected: "the founder rejected"
|
|
34811
34836
|
};
|
|
34812
34837
|
LINE_BREAKS = /\r\n|[\r\n\v\f\u0085\u2028\u2029]/;
|
|
34813
|
-
|
|
34838
|
+
CONTROL_CHARS3 = /[\u0000-\u001F\u007F-\u009F]/g;
|
|
34814
34839
|
}
|
|
34815
34840
|
});
|
|
34816
34841
|
|
package/dist/bin/jpi-hub.js
CHANGED
|
@@ -538,8 +538,24 @@ function nextPolledState(from, observed) {
|
|
|
538
538
|
function nowISO() {
|
|
539
539
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
540
540
|
}
|
|
541
|
+
function defangText(s) {
|
|
542
|
+
return typeof s === "string" ? s.replace(CONTROL_CHARS, "") : s;
|
|
543
|
+
}
|
|
544
|
+
function finiteAmount(a) {
|
|
545
|
+
if (typeof a === "number") return Number.isFinite(a) ? a : null;
|
|
546
|
+
if (typeof a !== "string" || a.trim() === "") return null;
|
|
547
|
+
const n = Number(a);
|
|
548
|
+
return Number.isFinite(n) ? n : null;
|
|
549
|
+
}
|
|
541
550
|
function normalizeClaim(c) {
|
|
542
|
-
return {
|
|
551
|
+
return {
|
|
552
|
+
...c,
|
|
553
|
+
kind: c.kind ?? "bounty",
|
|
554
|
+
policy: c.policy ?? null,
|
|
555
|
+
title: defangText(c.title),
|
|
556
|
+
repoFullName: defangText(c.repoFullName),
|
|
557
|
+
amountUSD: finiteAmount(c.amountUSD)
|
|
558
|
+
};
|
|
543
559
|
}
|
|
544
560
|
function readClaims() {
|
|
545
561
|
try {
|
|
@@ -661,7 +677,7 @@ function acceptedPRRate(claims = readClaims()) {
|
|
|
661
677
|
const merged = claims.filter((c) => c.state === "merged").length;
|
|
662
678
|
return { merged, total, rate: total === 0 ? 0 : merged / total };
|
|
663
679
|
}
|
|
664
|
-
var TERMINALHIRE_DIR, CLAIMS_FILE, LOCK_DIR, LOCK_STALE_MS, LOCK_RETRY_MS, LOCK_TIMEOUT_MS, CLAIM_STATES, PUSHED_CLAIM_FIELDS, TERMINAL_STATES, POLL_TRANSITIONS;
|
|
680
|
+
var TERMINALHIRE_DIR, CLAIMS_FILE, LOCK_DIR, LOCK_STALE_MS, LOCK_RETRY_MS, LOCK_TIMEOUT_MS, CLAIM_STATES, PUSHED_CLAIM_FIELDS, TERMINAL_STATES, POLL_TRANSITIONS, CONTROL_CHARS;
|
|
665
681
|
var init_claims = __esm({
|
|
666
682
|
"src/claims.ts"() {
|
|
667
683
|
"use strict";
|
|
@@ -717,6 +733,7 @@ var init_claims = __esm({
|
|
|
717
733
|
]),
|
|
718
734
|
submitted: /* @__PURE__ */ new Set(["claimed", "working", "in-review", "ready"])
|
|
719
735
|
};
|
|
736
|
+
CONTROL_CHARS = /[\x00-\x1f\x7f-\x9f]/g;
|
|
720
737
|
}
|
|
721
738
|
});
|
|
722
739
|
|
package/dist/bin/jpi-mcp.js
CHANGED
|
@@ -11140,8 +11140,24 @@ function nextPolledState(from, observed) {
|
|
|
11140
11140
|
function nowISO() {
|
|
11141
11141
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
11142
11142
|
}
|
|
11143
|
+
function defangText(s) {
|
|
11144
|
+
return typeof s === "string" ? s.replace(CONTROL_CHARS2, "") : s;
|
|
11145
|
+
}
|
|
11146
|
+
function finiteAmount(a) {
|
|
11147
|
+
if (typeof a === "number") return Number.isFinite(a) ? a : null;
|
|
11148
|
+
if (typeof a !== "string" || a.trim() === "") return null;
|
|
11149
|
+
const n = Number(a);
|
|
11150
|
+
return Number.isFinite(n) ? n : null;
|
|
11151
|
+
}
|
|
11143
11152
|
function normalizeClaim(c) {
|
|
11144
|
-
return {
|
|
11153
|
+
return {
|
|
11154
|
+
...c,
|
|
11155
|
+
kind: c.kind ?? "bounty",
|
|
11156
|
+
policy: c.policy ?? null,
|
|
11157
|
+
title: defangText(c.title),
|
|
11158
|
+
repoFullName: defangText(c.repoFullName),
|
|
11159
|
+
amountUSD: finiteAmount(c.amountUSD)
|
|
11160
|
+
};
|
|
11145
11161
|
}
|
|
11146
11162
|
function readClaims() {
|
|
11147
11163
|
try {
|
|
@@ -11263,7 +11279,7 @@ function acceptedPRRate(claims = readClaims()) {
|
|
|
11263
11279
|
const merged = claims.filter((c) => c.state === "merged").length;
|
|
11264
11280
|
return { merged, total, rate: total === 0 ? 0 : merged / total };
|
|
11265
11281
|
}
|
|
11266
|
-
var TERMINALHIRE_DIR5, CLAIMS_FILE, LOCK_DIR, LOCK_STALE_MS, LOCK_RETRY_MS, LOCK_TIMEOUT_MS, CLAIM_STATES, PUSHED_CLAIM_FIELDS, TERMINAL_STATES, POLL_TRANSITIONS;
|
|
11282
|
+
var TERMINALHIRE_DIR5, CLAIMS_FILE, LOCK_DIR, LOCK_STALE_MS, LOCK_RETRY_MS, LOCK_TIMEOUT_MS, CLAIM_STATES, PUSHED_CLAIM_FIELDS, TERMINAL_STATES, POLL_TRANSITIONS, CONTROL_CHARS2;
|
|
11267
11283
|
var init_claims = __esm({
|
|
11268
11284
|
"src/claims.ts"() {
|
|
11269
11285
|
"use strict";
|
|
@@ -11319,6 +11335,7 @@ var init_claims = __esm({
|
|
|
11319
11335
|
]),
|
|
11320
11336
|
submitted: /* @__PURE__ */ new Set(["claimed", "working", "in-review", "ready"])
|
|
11321
11337
|
};
|
|
11338
|
+
CONTROL_CHARS2 = /[\x00-\x1f\x7f-\x9f]/g;
|
|
11322
11339
|
}
|
|
11323
11340
|
});
|
|
11324
11341
|
|
|
@@ -27140,7 +27157,10 @@ async function pollPR(prUrl) {
|
|
|
27140
27157
|
}
|
|
27141
27158
|
}
|
|
27142
27159
|
function fmtAmount(a) {
|
|
27143
|
-
|
|
27160
|
+
if (a == null) return "$\u2014";
|
|
27161
|
+
if (typeof a === "string" && a.trim() === "") return "$\u2014";
|
|
27162
|
+
const n = typeof a === "number" ? a : Number(a);
|
|
27163
|
+
return Number.isFinite(n) ? "$" + n.toLocaleString() : "$\u2014";
|
|
27144
27164
|
}
|
|
27145
27165
|
function fmtClaimAmount(c) {
|
|
27146
27166
|
return c.kind === "contribution" ? "contribution" : fmtAmount(c.amountUSD);
|
|
@@ -28457,7 +28477,7 @@ function startableRow(c) {
|
|
|
28457
28477
|
}
|
|
28458
28478
|
async function pickStartableClaim(claims, { prompt = ask, isTTY = process.stdin.isTTY } = {}) {
|
|
28459
28479
|
const active = claims.listClaims({ active: true });
|
|
28460
|
-
await syncFounderApprovals(claims, active);
|
|
28480
|
+
const { approvalsChecked, approvalsUnavailable } = await syncFounderApprovals(claims, active);
|
|
28461
28481
|
const startable = claims.listClaims({ active: true }).filter((c) => c.state === "claimed");
|
|
28462
28482
|
if (startable.length === 0) {
|
|
28463
28483
|
console.log("No claims ready to start. Claim one first: terminalhire claim <ref>");
|
|
@@ -28485,23 +28505,24 @@ Which one? (1-${startable.length}, or q to quit) `);
|
|
|
28485
28505
|
Nothing started \u2014 '${answer}' is not one of 1-${startable.length}.`);
|
|
28486
28506
|
return null;
|
|
28487
28507
|
}
|
|
28488
|
-
return startable[n - 1].id;
|
|
28508
|
+
return { id: startable[n - 1].id, approvalsChecked, approvalsUnavailable };
|
|
28489
28509
|
}
|
|
28490
28510
|
async function cmdStart(id, flags = {}) {
|
|
28491
28511
|
const claims = await Promise.resolve().then(() => (init_claims(), claims_exports));
|
|
28512
|
+
let approvalsChecked = false;
|
|
28513
|
+
let approvalsUnavailable = false;
|
|
28492
28514
|
if (!id) {
|
|
28493
28515
|
const picked = await pickStartableClaim(claims);
|
|
28494
28516
|
if (!picked) return;
|
|
28495
|
-
id = picked;
|
|
28517
|
+
({ id, approvalsChecked, approvalsUnavailable } = picked);
|
|
28496
28518
|
}
|
|
28497
28519
|
let claim = claims.findClaim(id);
|
|
28498
28520
|
if (!claim) {
|
|
28499
28521
|
console.error(`terminalhire claim: no claim with id '${id}'.`);
|
|
28500
28522
|
process.exit(1);
|
|
28501
28523
|
}
|
|
28502
|
-
|
|
28503
|
-
|
|
28504
|
-
({ approvalsChecked } = await syncFounderApprovals(claims, [claim]));
|
|
28524
|
+
if (claim.approval?.state === "pending" && !approvalsChecked) {
|
|
28525
|
+
({ approvalsChecked, approvalsUnavailable } = await syncFounderApprovals(claims, [claim]));
|
|
28505
28526
|
claim = claims.findClaim(id);
|
|
28506
28527
|
}
|
|
28507
28528
|
if (claim.worktreePath) {
|
|
@@ -28528,6 +28549,10 @@ ${sanitizeText(claim.title)}`);
|
|
|
28528
28549
|
console.log(" same way.");
|
|
28529
28550
|
if (shouldStatePending(claim, approvalsChecked)) {
|
|
28530
28551
|
console.log("\n Access is pending \u2014 the founder has not approved your claim yet.");
|
|
28552
|
+
} else if (approvalsUnavailable) {
|
|
28553
|
+
console.log(
|
|
28554
|
+
"\n Terminalhire could not check approvals right now; local state was preserved.\n The next step below still works \u2014 it asks the server directly."
|
|
28555
|
+
);
|
|
28531
28556
|
}
|
|
28532
28557
|
printNextSteps([claim]);
|
|
28533
28558
|
return;
|
|
@@ -28767,7 +28792,7 @@ function renderRunView(run3, message) {
|
|
|
28767
28792
|
}
|
|
28768
28793
|
function terminalSafeLines(raw) {
|
|
28769
28794
|
if (typeof raw !== "string" || raw === "") return [];
|
|
28770
|
-
return raw.split(LINE_BREAKS).map((l) => l.replace(
|
|
28795
|
+
return raw.split(LINE_BREAKS).map((l) => l.replace(CONTROL_CHARS3, ""));
|
|
28771
28796
|
}
|
|
28772
28797
|
function terminalSafeInline(raw) {
|
|
28773
28798
|
return terminalSafeLines(raw).join(" ");
|
|
@@ -30218,7 +30243,7 @@ async function run() {
|
|
|
30218
30243
|
process.exit(1);
|
|
30219
30244
|
}
|
|
30220
30245
|
}
|
|
30221
|
-
var TERMINALHIRE_DIR11, INDEX_CACHE_FILE2, CLAIM_PUSH_MARKER, REPO_CONTINUITY_NUDGE_MARKER, API_URL, CLAIM_SYNC_BASE3, CLAIM_CONSENT_VERSION, CLAIM_POLL_INTERVAL_MS, CLAIM_POLL_TIMEOUT_MS, GH_API2, GH_HEADERS2, CONTENTION_HINT, AI_DISCLOSURE_NOTE, pExecFile, VALUE_FLAGS, ASSIGNMENT_MARKER, STAKE_MARKER, STANDDOWN_MARKER, OUR_MARKERS, STAKE_POST_TIMEOUT_MS, STAKE_POSTING_GRACE_MS, TAKE_BOT_REPOS, SUBMIT_ACCEPTS, REVISE_RECOVERY_STATES, PUSH_TOKEN_REFUSAL, SYNC_BACKGROUND_PUSH_ACTIVE_FIELD, ISSUE_OUTCOME_TERMINAL, RUNS_POLL_INTERVAL_MS, RUNS_POLL_ATTEMPTS, CLAIM_EVENT_LABEL, LINE_BREAKS,
|
|
30246
|
+
var TERMINALHIRE_DIR11, INDEX_CACHE_FILE2, CLAIM_PUSH_MARKER, REPO_CONTINUITY_NUDGE_MARKER, API_URL, CLAIM_SYNC_BASE3, CLAIM_CONSENT_VERSION, CLAIM_POLL_INTERVAL_MS, CLAIM_POLL_TIMEOUT_MS, GH_API2, GH_HEADERS2, CONTENTION_HINT, AI_DISCLOSURE_NOTE, pExecFile, VALUE_FLAGS, ASSIGNMENT_MARKER, STAKE_MARKER, STANDDOWN_MARKER, OUR_MARKERS, STAKE_POST_TIMEOUT_MS, STAKE_POSTING_GRACE_MS, TAKE_BOT_REPOS, SUBMIT_ACCEPTS, REVISE_RECOVERY_STATES, PUSH_TOKEN_REFUSAL, SYNC_BACKGROUND_PUSH_ACTIVE_FIELD, ISSUE_OUTCOME_TERMINAL, RUNS_POLL_INTERVAL_MS, RUNS_POLL_ATTEMPTS, CLAIM_EVENT_LABEL, LINE_BREAKS, CONTROL_CHARS3;
|
|
30222
30247
|
var init_jpi_claim = __esm({
|
|
30223
30248
|
"bin/jpi-claim.js"() {
|
|
30224
30249
|
"use strict";
|
|
@@ -30288,7 +30313,7 @@ var init_jpi_claim = __esm({
|
|
|
30288
30313
|
rejected: "the founder rejected"
|
|
30289
30314
|
};
|
|
30290
30315
|
LINE_BREAKS = /\r\n|[\r\n\v\f\u0085\u2028\u2029]/;
|
|
30291
|
-
|
|
30316
|
+
CONTROL_CHARS3 = /[\u0000-\u001F\u007F-\u009F]/g;
|
|
30292
30317
|
}
|
|
30293
30318
|
});
|
|
30294
30319
|
|
package/dist/bin/jpi-refresh.js
CHANGED
|
@@ -12562,8 +12562,24 @@ function nextPolledState(from, observed) {
|
|
|
12562
12562
|
function nowISO() {
|
|
12563
12563
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
12564
12564
|
}
|
|
12565
|
+
function defangText(s) {
|
|
12566
|
+
return typeof s === "string" ? s.replace(CONTROL_CHARS, "") : s;
|
|
12567
|
+
}
|
|
12568
|
+
function finiteAmount(a) {
|
|
12569
|
+
if (typeof a === "number") return Number.isFinite(a) ? a : null;
|
|
12570
|
+
if (typeof a !== "string" || a.trim() === "") return null;
|
|
12571
|
+
const n = Number(a);
|
|
12572
|
+
return Number.isFinite(n) ? n : null;
|
|
12573
|
+
}
|
|
12565
12574
|
function normalizeClaim(c) {
|
|
12566
|
-
return {
|
|
12575
|
+
return {
|
|
12576
|
+
...c,
|
|
12577
|
+
kind: c.kind ?? "bounty",
|
|
12578
|
+
policy: c.policy ?? null,
|
|
12579
|
+
title: defangText(c.title),
|
|
12580
|
+
repoFullName: defangText(c.repoFullName),
|
|
12581
|
+
amountUSD: finiteAmount(c.amountUSD)
|
|
12582
|
+
};
|
|
12567
12583
|
}
|
|
12568
12584
|
function readClaims() {
|
|
12569
12585
|
try {
|
|
@@ -12685,7 +12701,7 @@ function acceptedPRRate(claims = readClaims()) {
|
|
|
12685
12701
|
const merged = claims.filter((c) => c.state === "merged").length;
|
|
12686
12702
|
return { merged, total, rate: total === 0 ? 0 : merged / total };
|
|
12687
12703
|
}
|
|
12688
|
-
var TERMINALHIRE_DIR8, CLAIMS_FILE, LOCK_DIR, LOCK_STALE_MS2, LOCK_RETRY_MS, LOCK_TIMEOUT_MS, CLAIM_STATES, PUSHED_CLAIM_FIELDS, TERMINAL_STATES, POLL_TRANSITIONS;
|
|
12704
|
+
var TERMINALHIRE_DIR8, CLAIMS_FILE, LOCK_DIR, LOCK_STALE_MS2, LOCK_RETRY_MS, LOCK_TIMEOUT_MS, CLAIM_STATES, PUSHED_CLAIM_FIELDS, TERMINAL_STATES, POLL_TRANSITIONS, CONTROL_CHARS;
|
|
12689
12705
|
var init_claims = __esm({
|
|
12690
12706
|
"src/claims.ts"() {
|
|
12691
12707
|
"use strict";
|
|
@@ -12741,6 +12757,7 @@ var init_claims = __esm({
|
|
|
12741
12757
|
]),
|
|
12742
12758
|
submitted: /* @__PURE__ */ new Set(["claimed", "working", "in-review", "ready"])
|
|
12743
12759
|
};
|
|
12760
|
+
CONTROL_CHARS = /[\x00-\x1f\x7f-\x9f]/g;
|
|
12744
12761
|
}
|
|
12745
12762
|
});
|
|
12746
12763
|
|
package/dist/bin/jpi-repo.js
CHANGED
|
@@ -1909,8 +1909,24 @@ function nextPolledState(from, observed) {
|
|
|
1909
1909
|
function nowISO2() {
|
|
1910
1910
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
1911
1911
|
}
|
|
1912
|
+
function defangText(s) {
|
|
1913
|
+
return typeof s === "string" ? s.replace(CONTROL_CHARS, "") : s;
|
|
1914
|
+
}
|
|
1915
|
+
function finiteAmount(a) {
|
|
1916
|
+
if (typeof a === "number") return Number.isFinite(a) ? a : null;
|
|
1917
|
+
if (typeof a !== "string" || a.trim() === "") return null;
|
|
1918
|
+
const n = Number(a);
|
|
1919
|
+
return Number.isFinite(n) ? n : null;
|
|
1920
|
+
}
|
|
1912
1921
|
function normalizeClaim(c) {
|
|
1913
|
-
return {
|
|
1922
|
+
return {
|
|
1923
|
+
...c,
|
|
1924
|
+
kind: c.kind ?? "bounty",
|
|
1925
|
+
policy: c.policy ?? null,
|
|
1926
|
+
title: defangText(c.title),
|
|
1927
|
+
repoFullName: defangText(c.repoFullName),
|
|
1928
|
+
amountUSD: finiteAmount(c.amountUSD)
|
|
1929
|
+
};
|
|
1914
1930
|
}
|
|
1915
1931
|
function readClaims() {
|
|
1916
1932
|
try {
|
|
@@ -2032,7 +2048,7 @@ function acceptedPRRate(claims = readClaims()) {
|
|
|
2032
2048
|
const merged = claims.filter((c) => c.state === "merged").length;
|
|
2033
2049
|
return { merged, total, rate: total === 0 ? 0 : merged / total };
|
|
2034
2050
|
}
|
|
2035
|
-
var TERMINALHIRE_DIR4, CLAIMS_FILE, LOCK_DIR, LOCK_STALE_MS, LOCK_RETRY_MS, LOCK_TIMEOUT_MS, CLAIM_STATES, PUSHED_CLAIM_FIELDS, TERMINAL_STATES, POLL_TRANSITIONS;
|
|
2051
|
+
var TERMINALHIRE_DIR4, CLAIMS_FILE, LOCK_DIR, LOCK_STALE_MS, LOCK_RETRY_MS, LOCK_TIMEOUT_MS, CLAIM_STATES, PUSHED_CLAIM_FIELDS, TERMINAL_STATES, POLL_TRANSITIONS, CONTROL_CHARS;
|
|
2036
2052
|
var init_claims = __esm({
|
|
2037
2053
|
"src/claims.ts"() {
|
|
2038
2054
|
"use strict";
|
|
@@ -2088,6 +2104,7 @@ var init_claims = __esm({
|
|
|
2088
2104
|
]),
|
|
2089
2105
|
submitted: /* @__PURE__ */ new Set(["claimed", "working", "in-review", "ready"])
|
|
2090
2106
|
};
|
|
2107
|
+
CONTROL_CHARS = /[\x00-\x1f\x7f-\x9f]/g;
|
|
2091
2108
|
}
|
|
2092
2109
|
});
|
|
2093
2110
|
|
package/dist/src/claims.js
CHANGED
|
@@ -161,8 +161,25 @@ function nextPolledState(from, observed) {
|
|
|
161
161
|
function nowISO() {
|
|
162
162
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
163
163
|
}
|
|
164
|
+
var CONTROL_CHARS = /[\x00-\x1f\x7f-\x9f]/g;
|
|
165
|
+
function defangText(s) {
|
|
166
|
+
return typeof s === "string" ? s.replace(CONTROL_CHARS, "") : s;
|
|
167
|
+
}
|
|
168
|
+
function finiteAmount(a) {
|
|
169
|
+
if (typeof a === "number") return Number.isFinite(a) ? a : null;
|
|
170
|
+
if (typeof a !== "string" || a.trim() === "") return null;
|
|
171
|
+
const n = Number(a);
|
|
172
|
+
return Number.isFinite(n) ? n : null;
|
|
173
|
+
}
|
|
164
174
|
function normalizeClaim(c) {
|
|
165
|
-
return {
|
|
175
|
+
return {
|
|
176
|
+
...c,
|
|
177
|
+
kind: c.kind ?? "bounty",
|
|
178
|
+
policy: c.policy ?? null,
|
|
179
|
+
title: defangText(c.title),
|
|
180
|
+
repoFullName: defangText(c.repoFullName),
|
|
181
|
+
amountUSD: finiteAmount(c.amountUSD)
|
|
182
|
+
};
|
|
166
183
|
}
|
|
167
184
|
function readClaims() {
|
|
168
185
|
try {
|
package/package.json
CHANGED