harnesstap 1.4.0 → 1.6.0
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/README.md +2 -0
- package/dist/apply-FTAIL3X3.js +50 -0
- package/dist/{approve-FBGYQGWN.js → approve-R6AWQB3I.js} +10 -13
- package/dist/{approve-FBGYQGWN.js.map → approve-R6AWQB3I.js.map} +1 -1
- package/dist/{audit-VI4QZ6X2.js → audit-2HNKFPSU.js} +11 -15
- package/dist/{audit-VI4QZ6X2.js.map → audit-2HNKFPSU.js.map} +1 -1
- package/dist/{auth-4CQCDS2W.js → auth-C54KRLNF.js} +10 -12
- package/dist/{auth-4CQCDS2W.js.map → auth-C54KRLNF.js.map} +1 -1
- package/dist/bin.js +13 -34
- package/dist/bin.js.map +1 -1
- package/dist/{chunk-IE7B6Q5K.js → chunk-2XDYQXP2.js} +17 -18
- package/dist/chunk-2XDYQXP2.js.map +1 -0
- package/dist/{chunk-L6YZE5MY.js → chunk-3277RVZT.js} +5 -7
- package/dist/{chunk-L6YZE5MY.js.map → chunk-3277RVZT.js.map} +1 -1
- package/dist/{chunk-QA5U36JN.js → chunk-3Q72LZPJ.js} +764 -340
- package/dist/chunk-3Q72LZPJ.js.map +1 -0
- package/dist/{chunk-OML4HXKT.js → chunk-42E2MPES.js} +16 -22
- package/dist/chunk-42E2MPES.js.map +1 -0
- package/dist/{chunk-4ZQ2SCGY.js → chunk-5HACBPK2.js} +509 -207
- package/dist/chunk-5HACBPK2.js.map +1 -0
- package/dist/{chunk-GRASK6M6.js → chunk-6FXJIKEG.js} +5 -5
- package/dist/{chunk-73OJQTBW.js → chunk-A3TZT4WT.js} +2 -2
- package/dist/{chunk-ZUASVASP.js → chunk-BUA7WFI4.js} +27034 -18024
- package/dist/chunk-BUA7WFI4.js.map +1 -0
- package/dist/{chunk-U6DXASQP.js → chunk-CBSDMRMY.js} +2 -2
- package/dist/{chunk-RDG5DT7S.js → chunk-CR2TYMKC.js} +54 -40
- package/dist/chunk-CR2TYMKC.js.map +1 -0
- package/dist/{chunk-REHRUNBB.js → chunk-CWXCZBJR.js} +70 -5
- package/dist/chunk-CWXCZBJR.js.map +1 -0
- package/dist/{chunk-R7ZOYVN3.js → chunk-D7R577XZ.js} +187 -59
- package/dist/chunk-D7R577XZ.js.map +1 -0
- package/dist/{chunk-P2C7JPLD.js → chunk-EPXAOEBB.js} +6 -6
- package/dist/{chunk-D432JAXV.js → chunk-GZU4LVFF.js} +153 -25
- package/dist/chunk-GZU4LVFF.js.map +1 -0
- package/dist/chunk-HV3ENT2F.js +61 -0
- package/dist/chunk-HV3ENT2F.js.map +1 -0
- package/dist/{chunk-3P6BWL5F.js → chunk-K4UDZUJ2.js} +2 -2
- package/dist/{chunk-ULCD6DJE.js → chunk-L6BJCRBU.js} +14 -39
- package/dist/chunk-L6BJCRBU.js.map +1 -0
- package/dist/{chunk-M4KLHJ6U.js → chunk-M6FEDSHY.js} +8 -10
- package/dist/{chunk-M4KLHJ6U.js.map → chunk-M6FEDSHY.js.map} +1 -1
- package/dist/chunk-M7PHQ3UC.js +31491 -0
- package/dist/chunk-M7PHQ3UC.js.map +1 -0
- package/dist/{chunk-PNGF5EV2.js → chunk-MHLAIGIM.js} +2 -2
- package/dist/{chunk-BPWFQKI5.js → chunk-MHMFF6A5.js} +2 -2
- package/dist/chunk-MKLJBW5N.js +14 -0
- package/dist/{chunk-MR7IOHSX.js → chunk-MQCAPCAF.js} +16 -22
- package/dist/{chunk-MR7IOHSX.js.map → chunk-MQCAPCAF.js.map} +1 -1
- package/dist/{chunk-N3VGY3T3.js → chunk-MQCH3YZ5.js} +7 -5
- package/dist/{chunk-N3VGY3T3.js.map → chunk-MQCH3YZ5.js.map} +1 -1
- package/dist/{chunk-WG5A6EAU.js → chunk-OHZNDV4A.js} +821 -28
- package/dist/chunk-OHZNDV4A.js.map +1 -0
- package/dist/{chunk-WGP4GUYZ.js → chunk-OWE3OSX6.js} +9 -11
- package/dist/{chunk-WGP4GUYZ.js.map → chunk-OWE3OSX6.js.map} +1 -1
- package/dist/{chunk-RVEXPMM3.js → chunk-PCNHBMBU.js} +3 -5
- package/dist/{chunk-RVEXPMM3.js.map → chunk-PCNHBMBU.js.map} +1 -1
- package/dist/{chunk-23XSG7LI.js → chunk-QGTDQNVV.js} +4 -4
- package/dist/{chunk-UVVZHWD2.js → chunk-R27VZIF6.js} +2 -2
- package/dist/{chunk-TQ2NA4Z4.js → chunk-R4NV3Q7G.js} +8 -2
- package/dist/chunk-R4NV3Q7G.js.map +1 -0
- package/dist/{chunk-EOPFER6N.js → chunk-R6VFJKZB.js} +19 -5
- package/dist/chunk-R6VFJKZB.js.map +1 -0
- package/dist/{chunk-3FS775NP.js → chunk-RQLVXJH2.js} +85 -4
- package/dist/chunk-RQLVXJH2.js.map +1 -0
- package/dist/{chunk-JQOKQKQT.js → chunk-S2D5PWAO.js} +2 -2
- package/dist/{chunk-43BDGVN3.js → chunk-T4EKNX2Q.js} +56 -9
- package/dist/chunk-T4EKNX2Q.js.map +1 -0
- package/dist/{chunk-XTVGCVU4.js → chunk-TERYL7JH.js} +36 -37
- package/dist/chunk-TERYL7JH.js.map +1 -0
- package/dist/{chunk-6LTLYV5D.js → chunk-UC27MQ3T.js} +1064 -265
- package/dist/chunk-UC27MQ3T.js.map +1 -0
- package/dist/chunk-UEA4NCY2.js +106 -0
- package/dist/chunk-UEA4NCY2.js.map +1 -0
- package/dist/{chunk-7HP6AAI3.js → chunk-UK2IV2ZQ.js} +2 -2
- package/dist/{chunk-PCMON7Y2.js → chunk-UZCAYOIQ.js} +8 -10
- package/dist/{chunk-PCMON7Y2.js.map → chunk-UZCAYOIQ.js.map} +1 -1
- package/dist/{chunk-N3ZCH64F.js → chunk-V4UNYSZO.js} +86 -32
- package/dist/chunk-V4UNYSZO.js.map +1 -0
- package/dist/chunk-VAPCU2FX.js +70 -0
- package/dist/chunk-VAPCU2FX.js.map +1 -0
- package/dist/{chunk-RFQ3N7FB.js → chunk-WGVU3LA5.js} +11 -9
- package/dist/chunk-WGVU3LA5.js.map +1 -0
- package/dist/{chunk-IMROMZ2K.js → chunk-WQ3F4O7U.js} +19 -14
- package/dist/chunk-WQ3F4O7U.js.map +1 -0
- package/dist/chunk-XNS4I3W6.js +102 -0
- package/dist/chunk-XNS4I3W6.js.map +1 -0
- package/dist/{chunk-2A36HWDE.js → chunk-Y4I7ZCAE.js} +129 -136
- package/dist/chunk-Y4I7ZCAE.js.map +1 -0
- package/dist/{chunk-TPEJFLV7.js → chunk-ZKMSHLXP.js} +4 -6
- package/dist/{chunk-TPEJFLV7.js.map → chunk-ZKMSHLXP.js.map} +1 -1
- package/dist/{compile-GXADKGH5.js → compile-B2QG6BAQ.js} +33 -37
- package/dist/{compile-GXADKGH5.js.map → compile-B2QG6BAQ.js.map} +1 -1
- package/dist/{config-JMHNA2U5.js → config-D3F6ICZ2.js} +16 -21
- package/dist/{config-JMHNA2U5.js.map → config-D3F6ICZ2.js.map} +1 -1
- package/dist/{cursor-local-install-46RWRBDT.js → cursor-local-install-4HDIBX22.js} +8 -12
- package/dist/{cursor-local-install-46RWRBDT.js.map → cursor-local-install-4HDIBX22.js.map} +1 -1
- package/dist/cursor-local-install-LL367GZY.js +94 -0
- package/dist/cursor-local-install-LL367GZY.js.map +1 -0
- package/dist/{doctor-N7ZULPOL.js → doctor-QSGETVDE.js} +14 -17
- package/dist/doctor-QSGETVDE.js.map +1 -0
- package/dist/{environment-OBB3WU5B.js → environment-2JS4RWQA.js} +42 -50
- package/dist/environment-2JS4RWQA.js.map +1 -0
- package/dist/{github-PBYBGOLH.js → github-JXSTHLY2.js} +9 -10
- package/dist/{github-PBYBGOLH.js.map → github-JXSTHLY2.js.map} +1 -1
- package/dist/{harness-7KYATIV6.js → harness-GBI3AMLH.js} +25 -31
- package/dist/{harness-7KYATIV6.js.map → harness-GBI3AMLH.js.map} +1 -1
- package/dist/{help-EE3AJQD4.js → help-EC52ERIE.js} +15 -20
- package/dist/{help-EE3AJQD4.js.map → help-EC52ERIE.js.map} +1 -1
- package/dist/{help-VXWKLQ6A.js → help-VIRMBOPJ.js} +57 -575
- package/dist/help-VIRMBOPJ.js.map +1 -0
- package/dist/host-plugin-view-kept-XKHD6NGU.js +139 -0
- package/dist/host-plugin-view-kept-XKHD6NGU.js.map +1 -0
- package/dist/index.js +12 -16
- package/dist/{init-LBTMPDVJ.js → init-OK3K6ILG.js} +33 -41
- package/dist/{init-LBTMPDVJ.js.map → init-OK3K6ILG.js.map} +1 -1
- package/dist/live-read-cache-ESQQJBNS.js +13 -0
- package/dist/live-read-cache-WPUFHVMZ.js +12 -0
- package/dist/{lock-WLJRXRVK.js → lock-AA2F4I3K.js} +9 -12
- package/dist/{lock-WLJRXRVK.js.map → lock-AA2F4I3K.js.map} +1 -1
- package/dist/{marketplace-GXSV6QIY.js → marketplace-QUYCV23F.js} +26 -79
- package/dist/marketplace-QUYCV23F.js.map +1 -0
- package/dist/{mcp-XPDWWU75.js → mcp-CIHSR4DD.js} +33 -37
- package/dist/{mcp-XPDWWU75.js.map → mcp-CIHSR4DD.js.map} +1 -1
- package/dist/{migrate-SBUIWN3U.js → migrate-TQPEZYS5.js} +93 -34
- package/dist/migrate-TQPEZYS5.js.map +1 -0
- package/dist/notifications-TAELTPDW.js +154 -0
- package/dist/notifications-TAELTPDW.js.map +1 -0
- package/dist/open-D3GWGDSQ.js +20 -0
- package/dist/{pack-A73LDVOX.js → pack-VUO4UBWL.js} +10 -14
- package/dist/{pack-A73LDVOX.js.map → pack-VUO4UBWL.js.map} +1 -1
- package/dist/plugin-L3466DHK.js +47 -0
- package/dist/plugin-from-project-U5UGKTJH.js +15 -0
- package/dist/{policy-6VY3CMSU.js → policy-Z5TL4N3V.js} +9 -12
- package/dist/{policy-6VY3CMSU.js.map → policy-Z5TL4N3V.js.map} +1 -1
- package/dist/{profile-YCKPMRRU.js → profile-QFI7SL3S.js} +108 -78
- package/dist/profile-QFI7SL3S.js.map +1 -0
- package/dist/{project-KHPPBKPN.js → project-3KR3EPYR.js} +486 -60
- package/dist/project-3KR3EPYR.js.map +1 -0
- package/dist/{resource-IJU3FAN5.js → resource-45BPRQ7V.js} +55 -45
- package/dist/resource-45BPRQ7V.js.map +1 -0
- package/dist/status-refresh-worker.js +1155 -0
- package/dist/status-refresh-worker.js.map +1 -0
- package/dist/{version-Z66FWWMQ.js → version-QUJZGTZ5.js} +3 -3
- package/dist/version-QUJZGTZ5.js.map +1 -0
- package/package.json +16 -11
- package/dist/apply-SUNDXRJ3.js +0 -54
- package/dist/chunk-2A36HWDE.js.map +0 -1
- package/dist/chunk-2H7UOFLK.js +0 -11
- package/dist/chunk-3FS775NP.js.map +0 -1
- package/dist/chunk-43BDGVN3.js.map +0 -1
- package/dist/chunk-4ZQ2SCGY.js.map +0 -1
- package/dist/chunk-6LTLYV5D.js.map +0 -1
- package/dist/chunk-D432JAXV.js.map +0 -1
- package/dist/chunk-DF4Z7LAD.js +0 -3463
- package/dist/chunk-DF4Z7LAD.js.map +0 -1
- package/dist/chunk-EOPFER6N.js.map +0 -1
- package/dist/chunk-G6WKY2W4.js +0 -389
- package/dist/chunk-G6WKY2W4.js.map +0 -1
- package/dist/chunk-IE7B6Q5K.js.map +0 -1
- package/dist/chunk-IMROMZ2K.js.map +0 -1
- package/dist/chunk-M2U3J7UX.js +0 -46
- package/dist/chunk-M2U3J7UX.js.map +0 -1
- package/dist/chunk-N3ZCH64F.js.map +0 -1
- package/dist/chunk-NAGAJ5UM.js +0 -145
- package/dist/chunk-NAGAJ5UM.js.map +0 -1
- package/dist/chunk-OML4HXKT.js.map +0 -1
- package/dist/chunk-QA5U36JN.js.map +0 -1
- package/dist/chunk-R7ZOYVN3.js.map +0 -1
- package/dist/chunk-RDG5DT7S.js.map +0 -1
- package/dist/chunk-REHRUNBB.js.map +0 -1
- package/dist/chunk-RFQ3N7FB.js.map +0 -1
- package/dist/chunk-TQ2NA4Z4.js.map +0 -1
- package/dist/chunk-ULCD6DJE.js.map +0 -1
- package/dist/chunk-WG5A6EAU.js.map +0 -1
- package/dist/chunk-XGTTOO4R.js +0 -84
- package/dist/chunk-XGTTOO4R.js.map +0 -1
- package/dist/chunk-XTVGCVU4.js.map +0 -1
- package/dist/chunk-XUJKZQZA.js +0 -235
- package/dist/chunk-XUJKZQZA.js.map +0 -1
- package/dist/chunk-ZUASVASP.js.map +0 -1
- package/dist/doctor-N7ZULPOL.js.map +0 -1
- package/dist/environment-OBB3WU5B.js.map +0 -1
- package/dist/help-VXWKLQ6A.js.map +0 -1
- package/dist/live-read-cache-TUSP7U3D.js +0 -10
- package/dist/marketplace-GXSV6QIY.js.map +0 -1
- package/dist/migrate-SBUIWN3U.js.map +0 -1
- package/dist/open-HDGLYYVU.js +0 -24
- package/dist/plugin-CEO6ZJM5.js +0 -51
- package/dist/plugin-from-project-UK7VJVUP.js +0 -18
- package/dist/profile-YCKPMRRU.js.map +0 -1
- package/dist/project-KHPPBKPN.js.map +0 -1
- package/dist/resource-IJU3FAN5.js.map +0 -1
- /package/dist/{apply-SUNDXRJ3.js.map → apply-FTAIL3X3.js.map} +0 -0
- /package/dist/{chunk-GRASK6M6.js.map → chunk-6FXJIKEG.js.map} +0 -0
- /package/dist/{chunk-73OJQTBW.js.map → chunk-A3TZT4WT.js.map} +0 -0
- /package/dist/{chunk-U6DXASQP.js.map → chunk-CBSDMRMY.js.map} +0 -0
- /package/dist/{chunk-P2C7JPLD.js.map → chunk-EPXAOEBB.js.map} +0 -0
- /package/dist/{chunk-3P6BWL5F.js.map → chunk-K4UDZUJ2.js.map} +0 -0
- /package/dist/{chunk-PNGF5EV2.js.map → chunk-MHLAIGIM.js.map} +0 -0
- /package/dist/{chunk-BPWFQKI5.js.map → chunk-MHMFF6A5.js.map} +0 -0
- /package/dist/{chunk-2H7UOFLK.js.map → chunk-MKLJBW5N.js.map} +0 -0
- /package/dist/{chunk-23XSG7LI.js.map → chunk-QGTDQNVV.js.map} +0 -0
- /package/dist/{chunk-UVVZHWD2.js.map → chunk-R27VZIF6.js.map} +0 -0
- /package/dist/{chunk-JQOKQKQT.js.map → chunk-S2D5PWAO.js.map} +0 -0
- /package/dist/{chunk-7HP6AAI3.js.map → chunk-UK2IV2ZQ.js.map} +0 -0
- /package/dist/{live-read-cache-TUSP7U3D.js.map → live-read-cache-ESQQJBNS.js.map} +0 -0
- /package/dist/{open-HDGLYYVU.js.map → live-read-cache-WPUFHVMZ.js.map} +0 -0
- /package/dist/{plugin-CEO6ZJM5.js.map → open-D3GWGDSQ.js.map} +0 -0
- /package/dist/{plugin-from-project-UK7VJVUP.js.map → plugin-L3466DHK.js.map} +0 -0
- /package/dist/{version-Z66FWWMQ.js.map → plugin-from-project-U5UGKTJH.js.map} +0 -0
|
@@ -4,6 +4,112 @@ var __export = (target, all) => {
|
|
|
4
4
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
+
// src/services/package-cache/host-plugin-view-policy.ts
|
|
8
|
+
var forceReplace = false;
|
|
9
|
+
var blocked = [];
|
|
10
|
+
var kept = [];
|
|
11
|
+
var replaced = [];
|
|
12
|
+
function setHostPluginViewForceReplace(force) {
|
|
13
|
+
forceReplace = force;
|
|
14
|
+
}
|
|
15
|
+
function hostPluginViewForceReplace() {
|
|
16
|
+
return forceReplace;
|
|
17
|
+
}
|
|
18
|
+
function recordKeptHostPluginViewFiles(entry) {
|
|
19
|
+
const index = kept.findIndex((existing) => existing.hostView === entry.hostView);
|
|
20
|
+
const earlier = index >= 0 ? kept.splice(index, 1)[0] : void 0;
|
|
21
|
+
const alreadyReported = entry.alreadyReported === true && (earlier === void 0 || earlier.alreadyReported === true);
|
|
22
|
+
kept.push({ ...entry, alreadyReported });
|
|
23
|
+
}
|
|
24
|
+
function recordReplacedHostPluginViewFiles(entry) {
|
|
25
|
+
replaced.push(entry);
|
|
26
|
+
}
|
|
27
|
+
var added = /* @__PURE__ */ new Map();
|
|
28
|
+
function recordAddedHostPluginViewFiles(hostView, paths) {
|
|
29
|
+
if (paths.length === 0) return;
|
|
30
|
+
const files = added.get(hostView) ?? /* @__PURE__ */ new Set();
|
|
31
|
+
for (const path of paths) files.add(path);
|
|
32
|
+
added.set(hostView, files);
|
|
33
|
+
}
|
|
34
|
+
function recordBlockedHostPluginViewFiles(entry) {
|
|
35
|
+
const index = blocked.findIndex((existing) => existing.hostView === entry.hostView);
|
|
36
|
+
if (index >= 0) blocked.splice(index, 1);
|
|
37
|
+
if (entry.files.length > 0) blocked.push(entry);
|
|
38
|
+
}
|
|
39
|
+
function takeBlockedHostPluginViewFiles() {
|
|
40
|
+
return blocked.splice(0, blocked.length);
|
|
41
|
+
}
|
|
42
|
+
function hasHostPluginViewNotices() {
|
|
43
|
+
return kept.length > 0 || replaced.length > 0 || blocked.length > 0 || added.size > 0;
|
|
44
|
+
}
|
|
45
|
+
function hostPluginViewChangeCounts() {
|
|
46
|
+
let addedCount = 0;
|
|
47
|
+
for (const files of added.values()) addedCount += files.size;
|
|
48
|
+
let replacedCount = 0;
|
|
49
|
+
let removedCount = 0;
|
|
50
|
+
for (const entry of replaced) {
|
|
51
|
+
const removedHere = entry.removed?.length ?? 0;
|
|
52
|
+
removedCount += removedHere;
|
|
53
|
+
replacedCount += entry.files.length - removedHere;
|
|
54
|
+
}
|
|
55
|
+
return { replaced: replacedCount, removed: removedCount, added: addedCount };
|
|
56
|
+
}
|
|
57
|
+
function takeReplacedHostPluginViewFiles() {
|
|
58
|
+
added.clear();
|
|
59
|
+
return replaced.splice(0, replaced.length);
|
|
60
|
+
}
|
|
61
|
+
function pendingKeptHostPluginViewPaths() {
|
|
62
|
+
return keptHostPluginViewPaths((entry) => !entry.alreadyReported);
|
|
63
|
+
}
|
|
64
|
+
function allKeptHostPluginViewPaths() {
|
|
65
|
+
return keptHostPluginViewPaths(() => true);
|
|
66
|
+
}
|
|
67
|
+
function keptHostPluginViewPaths(include) {
|
|
68
|
+
return kept.filter(include).flatMap((entry) => {
|
|
69
|
+
const root = entry.homeRoot.replace(/[\\/]+$/, "");
|
|
70
|
+
const folder = entry.hostView.replace(/\\/g, "/");
|
|
71
|
+
const prefix = `${root.replace(/\\/g, "/")}/`;
|
|
72
|
+
if (!folder.startsWith(prefix)) return [];
|
|
73
|
+
const rel = folder.slice(prefix.length).replace(/\/+$/, "");
|
|
74
|
+
return entry.files.map((file) => `${rel}/${file.path.replace(/\\/g, "/")}`);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function takeKeptHostPluginViewFiles() {
|
|
78
|
+
return kept.splice(0, kept.length);
|
|
79
|
+
}
|
|
80
|
+
function hostPluginViewNoticesJson() {
|
|
81
|
+
const out = {};
|
|
82
|
+
if (kept.length > 0) {
|
|
83
|
+
out.kept_plugin_files = kept.flatMap(
|
|
84
|
+
(entry) => entry.files.map((file) => ({
|
|
85
|
+
folder: entry.hostView,
|
|
86
|
+
path: file.path,
|
|
87
|
+
reason: file.reason === "modified" ? "changed_since_written" : "not_written_by_harnesstap",
|
|
88
|
+
in_plugin: file.inPlugin !== false
|
|
89
|
+
}))
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
if (replaced.length > 0) {
|
|
93
|
+
out.replaced_plugin_files = replaced.map((entry) => ({
|
|
94
|
+
folder: entry.hostView,
|
|
95
|
+
files: entry.files,
|
|
96
|
+
not_written_by_harnesstap: entry.notWrittenByHarnessTap,
|
|
97
|
+
backup_id: entry.backupId
|
|
98
|
+
}));
|
|
99
|
+
}
|
|
100
|
+
if (blocked.length > 0) {
|
|
101
|
+
out.blocked_plugin_files = blocked.flatMap(
|
|
102
|
+
(entry) => entry.files.map((file) => ({
|
|
103
|
+
folder: entry.hostView,
|
|
104
|
+
path: file.path,
|
|
105
|
+
blocked_by: file.blockedBy,
|
|
106
|
+
kind: file.kind
|
|
107
|
+
}))
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
return out;
|
|
111
|
+
}
|
|
112
|
+
|
|
7
113
|
// src/copy/plurals.ts
|
|
8
114
|
function formatCount(count, noun, plural = `${noun}s`) {
|
|
9
115
|
return `${count} ${count === 1 ? noun : plural}`;
|
|
@@ -12,13 +118,585 @@ function pluralNoun(count, noun, plural = `${noun}s`) {
|
|
|
12
118
|
return count === 1 ? noun : plural;
|
|
13
119
|
}
|
|
14
120
|
|
|
121
|
+
// src/ui/progress.ts
|
|
122
|
+
import ora from "ora";
|
|
123
|
+
|
|
124
|
+
// src/ui/theme.ts
|
|
125
|
+
import chalk from "chalk";
|
|
126
|
+
function colorEnabled() {
|
|
127
|
+
return !process.env.NO_COLOR && chalk.level > 0;
|
|
128
|
+
}
|
|
129
|
+
function maybe(style) {
|
|
130
|
+
return (value) => colorEnabled() ? style(value) : value;
|
|
131
|
+
}
|
|
132
|
+
var icons = {
|
|
133
|
+
success: "\u2713",
|
|
134
|
+
warn: "\u26A0",
|
|
135
|
+
danger: "\u2717",
|
|
136
|
+
hint: "\u2192",
|
|
137
|
+
bullet: "\xB7",
|
|
138
|
+
profile: "\u25CE",
|
|
139
|
+
added: "+",
|
|
140
|
+
removed: "\u2212",
|
|
141
|
+
modified: "~"
|
|
142
|
+
};
|
|
143
|
+
var resourceTypeStyles = {
|
|
144
|
+
instruction: maybe((value) => chalk.hex("#60a5fa")(value)),
|
|
145
|
+
skill: maybe((value) => chalk.hex("#34d399")(value)),
|
|
146
|
+
rule: maybe((value) => chalk.hex("#fbbf24")(value)),
|
|
147
|
+
mcp_server: maybe((value) => chalk.hex("#a78bfa")(value)),
|
|
148
|
+
permission: maybe((value) => chalk.hex("#f87171")(value)),
|
|
149
|
+
hook: maybe((value) => chalk.hex("#fb923c")(value)),
|
|
150
|
+
agent: maybe((value) => chalk.hex("#c084fc")(value)),
|
|
151
|
+
command: maybe((value) => chalk.hex("#2dd4bf")(value)),
|
|
152
|
+
env_var: maybe((value) => chalk.hex("#94a3b8")(value)),
|
|
153
|
+
model_config: maybe((value) => chalk.hex("#e879f9")(value))
|
|
154
|
+
};
|
|
155
|
+
var mutedStyle = maybe((value) => chalk.hex("#6b7280")(value));
|
|
156
|
+
function styleResourceType(value) {
|
|
157
|
+
const style = resourceTypeStyles[value];
|
|
158
|
+
return style ? style(value) : mutedStyle(value);
|
|
159
|
+
}
|
|
160
|
+
var theme = {
|
|
161
|
+
// Existing tokens for backward compatibility
|
|
162
|
+
primary: maybe((value) => chalk.bold(value)),
|
|
163
|
+
accent: maybe((value) => chalk.hex("#3b82f6")(value)),
|
|
164
|
+
muted: mutedStyle,
|
|
165
|
+
success: maybe((value) => chalk.hex("#14b8a6")(value)),
|
|
166
|
+
warn: maybe((value) => chalk.hex("#e6b84d")(value)),
|
|
167
|
+
danger: maybe((value) => chalk.hex("#ef4444")(value)),
|
|
168
|
+
badge: maybe((value) => chalk.bgHex("#3b82f6").white.bold(` ${value} `)),
|
|
169
|
+
// Role-based tokens
|
|
170
|
+
heading: maybe((value) => chalk.bold.hex("#3b82f6")(value)),
|
|
171
|
+
label: maybe((value) => chalk.hex("#6b7280")(value)),
|
|
172
|
+
command: maybe((value) => chalk.hex("#14b8a6")(value)),
|
|
173
|
+
flag: maybe((value) => chalk.hex("#3b82f6")(value)),
|
|
174
|
+
entity: maybe((value) => chalk.hex("#e6b84d")(value)),
|
|
175
|
+
path: maybe((value) => chalk.hex("#8b5cf6")(value)),
|
|
176
|
+
info: maybe((value) => chalk.hex("#6b7280")(value)),
|
|
177
|
+
border: maybe((value) => chalk.hex("#374151")(value)),
|
|
178
|
+
resourceType: styleResourceType
|
|
179
|
+
};
|
|
180
|
+
function disableColor() {
|
|
181
|
+
process.env.NO_COLOR = "1";
|
|
182
|
+
chalk.level = 0;
|
|
183
|
+
}
|
|
184
|
+
function isTty() {
|
|
185
|
+
return process.stdout.isTTY === true;
|
|
186
|
+
}
|
|
187
|
+
function terminalColumns() {
|
|
188
|
+
return process.stdout.columns ?? 80;
|
|
189
|
+
}
|
|
190
|
+
function terminalRows() {
|
|
191
|
+
return process.stdout.rows ?? 24;
|
|
192
|
+
}
|
|
193
|
+
function getTableChars() {
|
|
194
|
+
return isTty() && !process.env.NO_COLOR ? {} : {
|
|
195
|
+
top: "-",
|
|
196
|
+
"top-mid": "+",
|
|
197
|
+
"top-left": "+",
|
|
198
|
+
"top-right": "+",
|
|
199
|
+
bottom: "-",
|
|
200
|
+
"bottom-mid": "+",
|
|
201
|
+
"bottom-left": "+",
|
|
202
|
+
"bottom-right": "+",
|
|
203
|
+
left: "|",
|
|
204
|
+
"left-mid": "+",
|
|
205
|
+
mid: "-",
|
|
206
|
+
"mid-mid": "+",
|
|
207
|
+
right: "|",
|
|
208
|
+
"right-mid": "+",
|
|
209
|
+
middle: "|"
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// src/ui/progress.ts
|
|
214
|
+
function createProgress(message) {
|
|
215
|
+
let spinner = null;
|
|
216
|
+
if (isTty() && process.env.NODE_ENV !== "test") {
|
|
217
|
+
spinner = ora(message).start();
|
|
218
|
+
}
|
|
219
|
+
return {
|
|
220
|
+
succeed(verdict) {
|
|
221
|
+
if (spinner) {
|
|
222
|
+
spinner.succeed(verdict);
|
|
223
|
+
spinner = null;
|
|
224
|
+
} else {
|
|
225
|
+
console.log(theme.success(`${icons.success} ${verdict}`));
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
fail(verdict) {
|
|
229
|
+
if (spinner) {
|
|
230
|
+
spinner.fail(verdict);
|
|
231
|
+
spinner = null;
|
|
232
|
+
} else {
|
|
233
|
+
console.error(theme.danger(`${icons.danger} ${verdict}`));
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
stop() {
|
|
237
|
+
spinner?.stop();
|
|
238
|
+
spinner = null;
|
|
239
|
+
},
|
|
240
|
+
update(message2) {
|
|
241
|
+
if (spinner) {
|
|
242
|
+
spinner.text = message2;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
var progress = {
|
|
248
|
+
start: (message) => createProgress(message),
|
|
249
|
+
stop: () => {
|
|
250
|
+
},
|
|
251
|
+
succeed: (message) => {
|
|
252
|
+
console.log(theme.success(`${icons.success} ${message}`));
|
|
253
|
+
},
|
|
254
|
+
fail: (message) => {
|
|
255
|
+
console.error(theme.danger(`${icons.danger} ${message}`));
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
// src/ui/format.ts
|
|
260
|
+
var format_exports = {};
|
|
261
|
+
__export(format_exports, {
|
|
262
|
+
formatAbsoluteTime: () => formatAbsoluteTime,
|
|
263
|
+
formatCount: () => formatCount,
|
|
264
|
+
formatRelativeTime: () => formatRelativeTime,
|
|
265
|
+
formatRelativeTimeWithAbsolute: () => formatRelativeTimeWithAbsolute,
|
|
266
|
+
shortenId: () => shortenId,
|
|
267
|
+
truncate: () => truncate
|
|
268
|
+
});
|
|
269
|
+
function truncate(value, width) {
|
|
270
|
+
if (value.length <= width) return value;
|
|
271
|
+
if (width <= 3) return ".".repeat(Math.max(1, width));
|
|
272
|
+
return `${value.slice(0, width - 3)}...`;
|
|
273
|
+
}
|
|
274
|
+
function shortenId(value) {
|
|
275
|
+
if (value.length <= 10) return value;
|
|
276
|
+
return `${value.slice(0, 4)}...${value.slice(-4)}`;
|
|
277
|
+
}
|
|
278
|
+
function formatAbsoluteTime(value, options) {
|
|
279
|
+
const date = value instanceof Date ? value : new Date(value);
|
|
280
|
+
const pad = (part) => String(part).padStart(2, "0");
|
|
281
|
+
const day = `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
|
|
282
|
+
if (options?.includeTime) {
|
|
283
|
+
return `${day} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
|
|
284
|
+
}
|
|
285
|
+
return day;
|
|
286
|
+
}
|
|
287
|
+
function formatRelativeTime(value) {
|
|
288
|
+
const date = value instanceof Date ? value : new Date(value);
|
|
289
|
+
const diffMs = Date.now() - date.getTime();
|
|
290
|
+
const minute = 6e4;
|
|
291
|
+
const hour = 60 * minute;
|
|
292
|
+
const day = 24 * hour;
|
|
293
|
+
if (diffMs < minute) {
|
|
294
|
+
return `${formatCount(Math.max(1, Math.floor(diffMs / 1e3)), "second")} ago`;
|
|
295
|
+
}
|
|
296
|
+
if (diffMs < hour) {
|
|
297
|
+
return `${formatCount(Math.floor(diffMs / minute), "minute")} ago`;
|
|
298
|
+
}
|
|
299
|
+
if (diffMs < day) {
|
|
300
|
+
return `${formatCount(Math.floor(diffMs / hour), "hour")} ago`;
|
|
301
|
+
}
|
|
302
|
+
if (diffMs <= 30 * day) {
|
|
303
|
+
return `${formatCount(Math.floor(diffMs / day), "day")} ago`;
|
|
304
|
+
}
|
|
305
|
+
return formatAbsoluteTime(date);
|
|
306
|
+
}
|
|
307
|
+
function formatRelativeTimeWithAbsolute(value) {
|
|
308
|
+
const relative = formatRelativeTime(value);
|
|
309
|
+
const absolute = formatAbsoluteTime(value, { includeTime: true });
|
|
310
|
+
if (relative === absolute) return relative;
|
|
311
|
+
return `${relative} (${absolute})`;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// src/ui/kv.ts
|
|
315
|
+
function renderKv(key, value, keyWidth = 20, indent = 2) {
|
|
316
|
+
const spaces = " ".repeat(indent);
|
|
317
|
+
return `${spaces}${theme.muted(key.padEnd(keyWidth))} ${value}`;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// src/ui/table.ts
|
|
321
|
+
import Table from "cli-table3";
|
|
322
|
+
var OFF_TTY_TABLE_WIDTH = 100;
|
|
323
|
+
function resolveTableMaxWidth(explicit) {
|
|
324
|
+
if (explicit !== void 0) {
|
|
325
|
+
return explicit;
|
|
326
|
+
}
|
|
327
|
+
if (isTty() && typeof process.stdout.columns === "number" && process.stdout.columns > 0) {
|
|
328
|
+
return process.stdout.columns;
|
|
329
|
+
}
|
|
330
|
+
if (isTty()) {
|
|
331
|
+
return terminalColumns();
|
|
332
|
+
}
|
|
333
|
+
return OFF_TTY_TABLE_WIDTH;
|
|
334
|
+
}
|
|
335
|
+
var ESC = String.fromCharCode(27);
|
|
336
|
+
var ANSI_SGR = new RegExp(`${ESC}\\[[0-9;]*m`, "g");
|
|
337
|
+
var ANSI_SGR_AT_START = new RegExp(`^${ESC}\\[[0-9;]*m`);
|
|
338
|
+
function visibleLength(value) {
|
|
339
|
+
return value.replace(ANSI_SGR, "").length;
|
|
340
|
+
}
|
|
341
|
+
function truncateTableCell(value, width) {
|
|
342
|
+
if (width <= 0) {
|
|
343
|
+
return "";
|
|
344
|
+
}
|
|
345
|
+
if (visibleLength(value) <= width) {
|
|
346
|
+
return value;
|
|
347
|
+
}
|
|
348
|
+
if (width <= 3) {
|
|
349
|
+
let visible2 = 0;
|
|
350
|
+
let index2 = 0;
|
|
351
|
+
while (index2 < value.length && visible2 < width) {
|
|
352
|
+
const match = value.slice(index2).match(ANSI_SGR_AT_START);
|
|
353
|
+
if (match) {
|
|
354
|
+
index2 += match[0].length;
|
|
355
|
+
continue;
|
|
356
|
+
}
|
|
357
|
+
visible2 += 1;
|
|
358
|
+
index2 += 1;
|
|
359
|
+
}
|
|
360
|
+
return value.slice(0, index2);
|
|
361
|
+
}
|
|
362
|
+
const budget = width - 3;
|
|
363
|
+
let visible = 0;
|
|
364
|
+
let index = 0;
|
|
365
|
+
while (index < value.length && visible < budget) {
|
|
366
|
+
const match = value.slice(index).match(ANSI_SGR_AT_START);
|
|
367
|
+
if (match) {
|
|
368
|
+
index += match[0].length;
|
|
369
|
+
continue;
|
|
370
|
+
}
|
|
371
|
+
visible += 1;
|
|
372
|
+
index += 1;
|
|
373
|
+
}
|
|
374
|
+
const sliced = value.slice(0, index);
|
|
375
|
+
const reset = sliced.includes(ESC) ? `${ESC}[0m` : "";
|
|
376
|
+
return `${sliced}...${reset}`;
|
|
377
|
+
}
|
|
378
|
+
function contentWidth(col, rows) {
|
|
379
|
+
return Math.max(
|
|
380
|
+
col.width,
|
|
381
|
+
col.header.length,
|
|
382
|
+
...rows.map((row) => {
|
|
383
|
+
const raw = String(row[col.key] ?? "");
|
|
384
|
+
const transformed = col.transform ? col.transform(raw) : raw;
|
|
385
|
+
return transformed.length;
|
|
386
|
+
})
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
function tableBorderOverhead(columnCount) {
|
|
390
|
+
return columnCount + 1;
|
|
391
|
+
}
|
|
392
|
+
function computeColumnWidths(columns, rows, maxWidth) {
|
|
393
|
+
const contentWidths = columns.map((col) => contentWidth(col, rows) + 2);
|
|
394
|
+
if (maxWidth === void 0) {
|
|
395
|
+
return contentWidths;
|
|
396
|
+
}
|
|
397
|
+
const overhead = tableBorderOverhead(columns.length);
|
|
398
|
+
const available = Math.max(columns.length, maxWidth - overhead);
|
|
399
|
+
const fitIndexes = columns.map((col, index) => col.fitContent ? index : -1).filter((index) => index >= 0);
|
|
400
|
+
const flexibleIndexes = columns.map((col, index) => col.fitContent ? -1 : index).filter((index) => index >= 0);
|
|
401
|
+
const widths = contentWidths.slice();
|
|
402
|
+
if (fitIndexes.length > 0) {
|
|
403
|
+
for (const index of fitIndexes) {
|
|
404
|
+
widths[index] = contentWidths[index] ?? 0;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
const fitTotal = fitIndexes.reduce((sum, index) => sum + (widths[index] ?? 0), 0);
|
|
408
|
+
const flexibleBudget = Math.max(flexibleIndexes.length, available - fitTotal);
|
|
409
|
+
if (flexibleIndexes.length === 0) {
|
|
410
|
+
return shrinkToAvailable(widths, columns, available);
|
|
411
|
+
}
|
|
412
|
+
const flexibleColumns = flexibleIndexes.map((index) => columns[index]);
|
|
413
|
+
const flexibleContent = flexibleIndexes.map((index) => contentWidths[index] ?? 0);
|
|
414
|
+
const flexibleWidths = allocateFlexibleColumnWidths(
|
|
415
|
+
flexibleColumns,
|
|
416
|
+
flexibleContent,
|
|
417
|
+
flexibleBudget
|
|
418
|
+
);
|
|
419
|
+
flexibleIndexes.forEach((columnIndex, innerIndex) => {
|
|
420
|
+
widths[columnIndex] = flexibleWidths[innerIndex] ?? widths[columnIndex] ?? 0;
|
|
421
|
+
});
|
|
422
|
+
return shrinkToAvailable(widths, columns, available);
|
|
423
|
+
}
|
|
424
|
+
function shrinkToAvailable(widths, columns, available) {
|
|
425
|
+
let allocated = widths.reduce((sum, width) => sum + width, 0);
|
|
426
|
+
if (allocated <= available) {
|
|
427
|
+
return widths;
|
|
428
|
+
}
|
|
429
|
+
let overflow = allocated - available;
|
|
430
|
+
for (let index = widths.length - 1; index >= 0 && overflow > 0; index--) {
|
|
431
|
+
if (columns[index]?.fitContent) {
|
|
432
|
+
continue;
|
|
433
|
+
}
|
|
434
|
+
const floor = columns[index]?.minWidth ?? 1;
|
|
435
|
+
const reducible = Math.max(0, (widths[index] ?? 0) - floor);
|
|
436
|
+
if (reducible <= 0) {
|
|
437
|
+
continue;
|
|
438
|
+
}
|
|
439
|
+
const take = Math.min(reducible, overflow);
|
|
440
|
+
widths[index] = (widths[index] ?? 0) - take;
|
|
441
|
+
overflow -= take;
|
|
442
|
+
}
|
|
443
|
+
for (let index = widths.length - 1; index >= 0 && overflow > 0; index--) {
|
|
444
|
+
const floor = 1;
|
|
445
|
+
const reducible = Math.max(0, (widths[index] ?? 0) - floor);
|
|
446
|
+
if (reducible <= 0) {
|
|
447
|
+
continue;
|
|
448
|
+
}
|
|
449
|
+
const take = Math.min(reducible, overflow);
|
|
450
|
+
widths[index] = (widths[index] ?? 0) - take;
|
|
451
|
+
overflow -= take;
|
|
452
|
+
}
|
|
453
|
+
return widths;
|
|
454
|
+
}
|
|
455
|
+
function allocateFlexibleColumnWidths(columns, contentWidths, available) {
|
|
456
|
+
if (columns.length === 0) {
|
|
457
|
+
return [];
|
|
458
|
+
}
|
|
459
|
+
const hasWidthShare = columns.some((col) => col.widthShare !== void 0);
|
|
460
|
+
if (hasWidthShare) {
|
|
461
|
+
const floors = columns.map((col) => col.minWidth ?? 0);
|
|
462
|
+
const shareSum = columns.reduce((sum, col) => sum + (col.widthShare ?? 0), 0);
|
|
463
|
+
const widths2 = columns.map((col, index) => {
|
|
464
|
+
const share = shareSum > 0 ? (col.widthShare ?? 0) / shareSum : 1 / columns.length;
|
|
465
|
+
return Math.max(floors[index] ?? 0, Math.floor(available * share));
|
|
466
|
+
});
|
|
467
|
+
let allocated2 = widths2.reduce((sum, width) => sum + width, 0);
|
|
468
|
+
if (allocated2 > available) {
|
|
469
|
+
let overflow = allocated2 - available;
|
|
470
|
+
for (let index = widths2.length - 1; index >= 0 && overflow > 0; index--) {
|
|
471
|
+
const reducible = (widths2[index] ?? 0) - (floors[index] ?? 0);
|
|
472
|
+
if (reducible <= 0) {
|
|
473
|
+
continue;
|
|
474
|
+
}
|
|
475
|
+
const take = Math.min(reducible, overflow);
|
|
476
|
+
widths2[index] = (widths2[index] ?? 0) - take;
|
|
477
|
+
overflow -= take;
|
|
478
|
+
}
|
|
479
|
+
allocated2 = widths2.reduce((sum, width) => sum + width, 0);
|
|
480
|
+
}
|
|
481
|
+
if (widths2.length > 0 && allocated2 < available) {
|
|
482
|
+
widths2[0] = (widths2[0] ?? 0) + available - allocated2;
|
|
483
|
+
}
|
|
484
|
+
return widths2;
|
|
485
|
+
}
|
|
486
|
+
const total = contentWidths.reduce((sum, width) => sum + width, 0);
|
|
487
|
+
if (total <= available) {
|
|
488
|
+
return contentWidths;
|
|
489
|
+
}
|
|
490
|
+
const minWidths = columns.map(
|
|
491
|
+
(col, index) => Math.min(col.width + 2, contentWidths[index] ?? col.width + 2)
|
|
492
|
+
);
|
|
493
|
+
const minTotal = minWidths.reduce((sum, width) => sum + width, 0);
|
|
494
|
+
if (minTotal >= available) {
|
|
495
|
+
let remaining = available;
|
|
496
|
+
return minWidths.map((width, index) => {
|
|
497
|
+
if (index === minWidths.length - 1) {
|
|
498
|
+
return remaining;
|
|
499
|
+
}
|
|
500
|
+
const capped = Math.min(width, remaining);
|
|
501
|
+
remaining -= capped;
|
|
502
|
+
return capped;
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
const extra = contentWidths.map((width, index) => width - (minWidths[index] ?? 0));
|
|
506
|
+
const extraTotal = extra.reduce((sum, width) => sum + width, 0);
|
|
507
|
+
const budget = available - minTotal;
|
|
508
|
+
const widths = minWidths.map((min, index) => {
|
|
509
|
+
if (extraTotal === 0) {
|
|
510
|
+
return min;
|
|
511
|
+
}
|
|
512
|
+
return min + Math.floor(budget * (extra[index] ?? 0) / extraTotal);
|
|
513
|
+
});
|
|
514
|
+
const allocated = widths.reduce((sum, width) => sum + width, 0);
|
|
515
|
+
if (widths.length > 0) {
|
|
516
|
+
widths[0] = (widths[0] ?? 0) + available - allocated;
|
|
517
|
+
}
|
|
518
|
+
return widths;
|
|
519
|
+
}
|
|
520
|
+
function renderTable({
|
|
521
|
+
columns,
|
|
522
|
+
rows,
|
|
523
|
+
summary,
|
|
524
|
+
empty,
|
|
525
|
+
maxWidth,
|
|
526
|
+
wordWrap,
|
|
527
|
+
wrapOnWordBoundary
|
|
528
|
+
}) {
|
|
529
|
+
if (rows.length === 0 && empty) {
|
|
530
|
+
return empty;
|
|
531
|
+
}
|
|
532
|
+
const resolvedMaxWidth = resolveTableMaxWidth(maxWidth);
|
|
533
|
+
const colWidths = computeColumnWidths(columns, rows, resolvedMaxWidth);
|
|
534
|
+
const t = new Table({
|
|
535
|
+
head: columns.map((col) => theme.heading(col.header)),
|
|
536
|
+
colWidths,
|
|
537
|
+
chars: getTableChars(),
|
|
538
|
+
truncate: "...",
|
|
539
|
+
style: { head: [], border: [] },
|
|
540
|
+
...wordWrap !== void 0 ? { wordWrap } : {},
|
|
541
|
+
...wrapOnWordBoundary !== void 0 ? { wrapOnWordBoundary } : {}
|
|
542
|
+
});
|
|
543
|
+
for (const row of rows) {
|
|
544
|
+
t.push(
|
|
545
|
+
columns.map((col, index) => {
|
|
546
|
+
const raw = String(row[col.key] ?? "");
|
|
547
|
+
const transformed = col.transform ? col.transform(raw) : raw;
|
|
548
|
+
const innerWidth = Math.max(0, (colWidths[index] ?? col.width) - 2);
|
|
549
|
+
const clipOverflow = Boolean(col.truncate) || Boolean(col.fitContent) || !wordWrap;
|
|
550
|
+
const clipped = clipOverflow ? truncateTableCell(transformed, innerWidth) : transformed;
|
|
551
|
+
const content = col.style ? col.style(clipped) : clipped;
|
|
552
|
+
if (col.wrapOnWordBoundary === false) {
|
|
553
|
+
return { content, wrapOnWordBoundary: false };
|
|
554
|
+
}
|
|
555
|
+
return content;
|
|
556
|
+
})
|
|
557
|
+
);
|
|
558
|
+
}
|
|
559
|
+
const lines = [t.toString()];
|
|
560
|
+
if (summary) {
|
|
561
|
+
lines.push("");
|
|
562
|
+
lines.push(theme.info(summary));
|
|
563
|
+
}
|
|
564
|
+
return lines.join("\n");
|
|
565
|
+
}
|
|
566
|
+
var table = {
|
|
567
|
+
render: renderTable,
|
|
568
|
+
print: (opts) => console.log(renderTable(opts))
|
|
569
|
+
};
|
|
570
|
+
|
|
571
|
+
// src/ui/panel.ts
|
|
572
|
+
function renderPanelTitle(parts) {
|
|
573
|
+
const [head, ...rest] = parts;
|
|
574
|
+
return rest.length === 0 ? theme.primary(head ?? "") : `${theme.primary(head ?? "")} ${rest.map((p) => theme.muted(p)).join(" ")}`;
|
|
575
|
+
}
|
|
576
|
+
function renderPanel(opts) {
|
|
577
|
+
const lines = [renderPanelTitle(opts.title)];
|
|
578
|
+
for (const [key, value] of opts.rows) {
|
|
579
|
+
lines.push(renderKv(key, value));
|
|
580
|
+
}
|
|
581
|
+
return lines.join("\n");
|
|
582
|
+
}
|
|
583
|
+
function panel(opts) {
|
|
584
|
+
console.log(renderPanel(opts));
|
|
585
|
+
}
|
|
586
|
+
function kvBlock(rows, opts) {
|
|
587
|
+
for (const row of rows) {
|
|
588
|
+
console.log(renderKv(row.key, row.value, opts?.keyWidth, opts?.indent));
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
// src/ui/diff.ts
|
|
593
|
+
function renderDiffTable({ rows, title }) {
|
|
594
|
+
const lines = [];
|
|
595
|
+
if (title) {
|
|
596
|
+
lines.push(theme.primary(title));
|
|
597
|
+
}
|
|
598
|
+
for (const row of rows) {
|
|
599
|
+
lines.push(` ${theme.muted(row.key)}`);
|
|
600
|
+
lines.push(` ${theme.danger(`${icons.removed} ${row.before}`)}`);
|
|
601
|
+
lines.push(` ${theme.success(`${icons.added} ${row.after}`)}`);
|
|
602
|
+
}
|
|
603
|
+
return lines.join("\n");
|
|
604
|
+
}
|
|
605
|
+
var diffTable = {
|
|
606
|
+
render: renderDiffTable,
|
|
607
|
+
print: (opts) => console.log(renderDiffTable(opts))
|
|
608
|
+
};
|
|
609
|
+
function renderChangeList(changes) {
|
|
610
|
+
return changes.map((change) => {
|
|
611
|
+
const glyph = change.kind === "added" ? icons.added : change.kind === "removed" ? icons.removed : icons.modified;
|
|
612
|
+
const style = change.kind === "added" ? theme.success : change.kind === "removed" ? theme.danger : theme.warn;
|
|
613
|
+
return ` ${style(glyph)} ${change.scope.padEnd(10)} ${change.key.padEnd(28)} ${change.detail}`;
|
|
614
|
+
}).join("\n");
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
// src/ui/status.ts
|
|
618
|
+
function line(icon, message) {
|
|
619
|
+
return `${icon} ${message}`;
|
|
620
|
+
}
|
|
621
|
+
function renderSuccess(message, opts) {
|
|
622
|
+
return opts?.hint ? `${theme.success(line(icons.success, message))}
|
|
623
|
+
${theme.info(`${icons.hint} ${opts.hint}`)}` : theme.success(line(icons.success, message));
|
|
624
|
+
}
|
|
625
|
+
function renderWarn(message, opts) {
|
|
626
|
+
return opts?.hint ? `${theme.warn(line(icons.warn, message))}
|
|
627
|
+
${theme.info(`${icons.hint} ${opts.hint}`)}` : theme.warn(line(icons.warn, message));
|
|
628
|
+
}
|
|
629
|
+
function renderDanger(message, opts) {
|
|
630
|
+
const hints = opts?.hints ?? (opts?.hint ? [opts.hint] : []);
|
|
631
|
+
const base = theme.danger(line(icons.danger, message));
|
|
632
|
+
if (hints.length === 0) {
|
|
633
|
+
return base;
|
|
634
|
+
}
|
|
635
|
+
return `${base}
|
|
636
|
+
${hints.map((hint) => ` ${theme.info(`${icons.hint} ${hint}`)}`).join("\n")}`;
|
|
637
|
+
}
|
|
638
|
+
var status = {
|
|
639
|
+
success: (message, opts) => console.log(renderSuccess(message, opts)),
|
|
640
|
+
warn: (message, opts) => console.log(renderWarn(message, opts)),
|
|
641
|
+
danger: (message, opts) => console.error(renderDanger(message, opts)),
|
|
642
|
+
info: (message) => console.log(theme.info(message)),
|
|
643
|
+
dim: (message) => console.log(theme.info(message)),
|
|
644
|
+
hint: (message) => console.log(` ${theme.info(`${icons.hint} ${message}`)}`)
|
|
645
|
+
};
|
|
646
|
+
|
|
647
|
+
// src/ui/section.ts
|
|
648
|
+
function renderHeader(title) {
|
|
649
|
+
return theme.heading(title);
|
|
650
|
+
}
|
|
651
|
+
function renderSubheader(title) {
|
|
652
|
+
return theme.label(title);
|
|
653
|
+
}
|
|
654
|
+
function renderRule() {
|
|
655
|
+
return theme.border("\u2500".repeat(terminalColumns()));
|
|
656
|
+
}
|
|
657
|
+
function header(title) {
|
|
658
|
+
console.log(renderHeader(title));
|
|
659
|
+
}
|
|
660
|
+
function subheader(title) {
|
|
661
|
+
console.log(renderSubheader(title));
|
|
662
|
+
}
|
|
663
|
+
function rule() {
|
|
664
|
+
console.log(renderRule());
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
// src/ui/index.ts
|
|
668
|
+
var ui = {
|
|
669
|
+
format: format_exports,
|
|
670
|
+
icons,
|
|
671
|
+
theme,
|
|
672
|
+
header,
|
|
673
|
+
renderHeader,
|
|
674
|
+
subheader,
|
|
675
|
+
renderSubheader,
|
|
676
|
+
rule,
|
|
677
|
+
renderRule,
|
|
678
|
+
table,
|
|
679
|
+
renderTable,
|
|
680
|
+
panel,
|
|
681
|
+
renderPanel,
|
|
682
|
+
kvBlock,
|
|
683
|
+
renderKv,
|
|
684
|
+
diffTable,
|
|
685
|
+
renderDiffTable,
|
|
686
|
+
renderChangeList,
|
|
687
|
+
spinner: progress,
|
|
688
|
+
createProgress,
|
|
689
|
+
...status,
|
|
690
|
+
disableColor
|
|
691
|
+
};
|
|
692
|
+
|
|
15
693
|
// src/version.ts
|
|
16
694
|
import { execFileSync } from "child_process";
|
|
17
695
|
|
|
18
696
|
// package.json
|
|
19
697
|
var package_default = {
|
|
20
698
|
name: "harnesstap",
|
|
21
|
-
version: "1.
|
|
699
|
+
version: "1.6.0",
|
|
22
700
|
description: "Agent harness configuration toolkit for Claude Code, Codex, Cursor, and other coding CLIs",
|
|
23
701
|
type: "module",
|
|
24
702
|
packageManager: "bun@1.3.9",
|
|
@@ -58,25 +736,28 @@ var package_default = {
|
|
|
58
736
|
unlink: "bun unlink",
|
|
59
737
|
test: "bun test --timeout 30000",
|
|
60
738
|
"test:run": "bun test --dots --timeout 30000",
|
|
61
|
-
"test:core": "bun test --dots test/models test/db test/config test/utils test/telemetry test/scripts",
|
|
62
|
-
"test:platforms": "bun test --dots test/platforms",
|
|
63
|
-
"test:plugins": "bun test --dots test/plugins",
|
|
64
|
-
"test:services": "bun test --dots test/services test/integration
|
|
65
|
-
"test:cli": "bun test --dots test/cli test/ui test/helpers",
|
|
66
|
-
"test:
|
|
739
|
+
"test:core": "bun test --dots --timeout 30000 test/models test/db test/config test/utils test/telemetry test/scripts",
|
|
740
|
+
"test:platforms": "bun test --dots --timeout 30000 test/platforms",
|
|
741
|
+
"test:plugins": "bun test --dots --timeout 30000 test/plugins",
|
|
742
|
+
"test:services": "bun test --dots --timeout 30000 test/services test/integration",
|
|
743
|
+
"test:cli": "bun test --dots --timeout 30000 test/cli test/ui test/helpers",
|
|
744
|
+
"test:agent": "bun test --dots --timeout 30000 test/agent",
|
|
745
|
+
"test:desktop": "bun test --dots --timeout 30000 test/desktop",
|
|
746
|
+
"test:docs": "bun test --dots --timeout 30000 test/docs",
|
|
67
747
|
lint: "biome lint .",
|
|
68
748
|
"lint:fix": "biome lint --write --unsafe .",
|
|
69
749
|
"lint:css": "bun scripts/check-css-tokens.ts",
|
|
70
750
|
"check:cli-error-contract": "bun scripts/check-cli-error-contract.ts",
|
|
71
751
|
"check:copy": "bun scripts/check-copy.ts",
|
|
72
|
-
"check:agent-plugins-spec": "bun test test/services/agent-plugins/spec-schema-guard.test.ts test/services/agent-plugins/spec-mcp.test.ts test/services/agent-plugins/spec-load.test.ts",
|
|
752
|
+
"check:agent-plugins-spec": "bun test --timeout 30000 test/services/agent-plugins/spec-schema-guard.test.ts test/services/agent-plugins/spec-mcp.test.ts test/services/agent-plugins/spec-load.test.ts",
|
|
73
753
|
typecheck: "tsc --noEmit",
|
|
74
754
|
clean: "rm -rf dist && find . -maxdepth 1 -name '*.bun-build' -delete",
|
|
75
755
|
preflight: "bun run lint && bun run lint:css && bun run check:cli-error-contract && bun run check:copy && bun run typecheck && bun run test:run && bun run build",
|
|
76
|
-
prepublishOnly: "bun run build",
|
|
756
|
+
prepublishOnly: "HT_RELEASE=1 bun run build",
|
|
757
|
+
"check:release-version": "bash scripts/check-release-version.sh",
|
|
77
758
|
"docs:vhs": "bash scripts/generate-vhs-scenarios.sh",
|
|
78
759
|
"check:scenario-docs": "bash scripts/check-scenario-docs.sh",
|
|
79
|
-
"check:scenario-smoke": "bun test test/cli/scenario-smoke.test.ts",
|
|
760
|
+
"check:scenario-smoke": "bun test --timeout 30000 test/cli/scenario-smoke.test.ts",
|
|
80
761
|
"check:sqlite-wal-smoke": "bun scripts/sqlite-wal-write-smoke.ts",
|
|
81
762
|
"sync:cloud-docs": "bash scripts/sync-cloud-cli-docs.sh"
|
|
82
763
|
},
|
|
@@ -106,7 +787,6 @@ var package_default = {
|
|
|
106
787
|
dependencies: {
|
|
107
788
|
"@inquirer/core": "^10.3.2",
|
|
108
789
|
"@inquirer/search": "^3.2.2",
|
|
109
|
-
"better-sqlite3": "^12.11.1",
|
|
110
790
|
chalk: "^5.4.1",
|
|
111
791
|
"cli-table3": "^0.6.5",
|
|
112
792
|
commander: "^13.1.0",
|
|
@@ -120,6 +800,9 @@ var package_default = {
|
|
|
120
800
|
ulid: "^2.3.0",
|
|
121
801
|
yaml: "^2.7.0"
|
|
122
802
|
},
|
|
803
|
+
optionalDependencies: {
|
|
804
|
+
"better-sqlite3": "^12.11.1"
|
|
805
|
+
},
|
|
123
806
|
devDependencies: {
|
|
124
807
|
"@biomejs/biome": "^2.4.10",
|
|
125
808
|
"@inquirer/testing": "^3.3.8",
|
|
@@ -182,16 +865,37 @@ function resolveBuildVersion(env = process.env) {
|
|
|
182
865
|
});
|
|
183
866
|
}
|
|
184
867
|
function resolvePackageVersion() {
|
|
185
|
-
if ("1.
|
|
186
|
-
return "1.
|
|
868
|
+
if ("1.6.0".length > 0) {
|
|
869
|
+
return "1.6.0";
|
|
187
870
|
}
|
|
188
871
|
return resolveBuildVersion();
|
|
189
872
|
}
|
|
190
873
|
var PACKAGE_VERSION = resolvePackageVersion();
|
|
191
874
|
|
|
875
|
+
// src/services/cli-errors.ts
|
|
876
|
+
var CliUsageError = class extends Error {
|
|
877
|
+
constructor(message, hints = [], exitCode = 1) {
|
|
878
|
+
super(message);
|
|
879
|
+
this.hints = hints;
|
|
880
|
+
this.name = "CliUsageError";
|
|
881
|
+
this.exitCode = exitCode;
|
|
882
|
+
}
|
|
883
|
+
exitCode;
|
|
884
|
+
};
|
|
885
|
+
function missingRequiredArg(name, commandPath) {
|
|
886
|
+
return new CliUsageError(
|
|
887
|
+
`missing required argument '${name}'`,
|
|
888
|
+
[`Run ht ${commandPath} --help to see the options.`]
|
|
889
|
+
);
|
|
890
|
+
}
|
|
891
|
+
function conflictingOptions(a, b) {
|
|
892
|
+
return new CliUsageError(`error: cannot use ${a} together with ${b}`);
|
|
893
|
+
}
|
|
894
|
+
|
|
192
895
|
// src/copy/cli.ts
|
|
193
896
|
var DRY_RUN_NOTHING_CHANGED = "Dry run. Nothing was changed.";
|
|
194
897
|
var NATIVE_MODULE_MISMATCH_MESSAGE = "HarnessTap was installed under a different Node.js version. Run: npm rebuild -g harnesstap";
|
|
898
|
+
var SQLITE_MODULE_MISSING_MESSAGE = "HarnessTap could not load its SQLite module (better-sqlite3), which did not install for this Node.js. Reinstall on Node 22.12 or newer: npm install -g harnesstap. Or run it on Bun: bun x --bun harnesstap@latest";
|
|
195
899
|
function quoteCliArg(value) {
|
|
196
900
|
if (value.length === 0) {
|
|
197
901
|
return '""';
|
|
@@ -284,7 +988,8 @@ var CLI_HINTS = {
|
|
|
284
988
|
mcpSearch: (name) => `Run ht mcp search ${hintToken(name)} to find it.`,
|
|
285
989
|
scopeAdd: (name, harnesses) => `Run ht resource scope ${hintToken(name)} --add ${hintToken(harnesses)}.`,
|
|
286
990
|
portableMcpTip: (name, harnessList, command) => `Tip: ${quoteName(name)} also works on ${harnessList}. Run ${command}.`,
|
|
287
|
-
forceRemove: "To remove them too, run
|
|
991
|
+
forceRemove: "To remove them too, run the command again with --force-remove.",
|
|
992
|
+
forceRemoveAlreadyUsed: "HarnessTap never removes these, even with --force-remove.",
|
|
288
993
|
revert: "Snapshot saved. Undo with: ht revert",
|
|
289
994
|
stashPop: "Bring them back with: ht profile stash pop",
|
|
290
995
|
harnessSet: "Run ht harness set to pick your harnesses.",
|
|
@@ -312,6 +1017,7 @@ var CLI_ERRORS = {
|
|
|
312
1017
|
newerSchema: "This data was saved by a newer HarnessTap.",
|
|
313
1018
|
noHarnesses: "Not set up for any harness yet.",
|
|
314
1019
|
unsavedChanges: (name, count) => `${quoteName(name)} has ${count} unsaved change${count === 1 ? "" : "s"}.`,
|
|
1020
|
+
resourceSyncFailed: (refs) => `Could not install ${[...new Set(refs)].join(", ")}.`,
|
|
315
1021
|
resourceSyncStale: (count) => `${count} linked resource${count === 1 ? "" : "s"} ${count === 1 ? "is" : "are"} stale.`
|
|
316
1022
|
};
|
|
317
1023
|
var SWITCH_CHANGES_VALUES = ["save", "stash", "discard"];
|
|
@@ -336,11 +1042,11 @@ var CLI_COPY = {
|
|
|
336
1042
|
dryRunNothingChanged: DRY_RUN_NOTHING_CHANGED,
|
|
337
1043
|
everythingUpToDate: "Everything is up to date.",
|
|
338
1044
|
snapshotSavedUndo: "Snapshot saved. Undo with:",
|
|
339
|
-
forceRemoveHint: "To remove them too, run:",
|
|
340
1045
|
keptYouChanged: "you changed it",
|
|
1046
|
+
keptClaudeChanged: "Claude Code changed it",
|
|
341
1047
|
keptNotMade: "not made by HarnessTap",
|
|
342
1048
|
viewSnapshot: "View snapshot",
|
|
343
|
-
keptFilesIntro: "
|
|
1049
|
+
keptFilesIntro: "you changed or that HarnessTap didn't create:"
|
|
344
1050
|
};
|
|
345
1051
|
function onConflictReplaceHint(conflicts) {
|
|
346
1052
|
const count = new Set(
|
|
@@ -377,7 +1083,7 @@ function savedChangesLine(profileName, count) {
|
|
|
377
1083
|
return `Saved ${count} ${pluralNoun(count, "change")} to ${quoteName(profileName)}.`;
|
|
378
1084
|
}
|
|
379
1085
|
function stashedChangesLine(count, popCommand) {
|
|
380
|
-
return `Stashed ${count} ${pluralNoun(count, "change")}. Bring them back with: ${popCommand}`;
|
|
1086
|
+
return `Stashed ${count} ${pluralNoun(count, "change")}. Bring ${count === 1 ? "it" : "them"} back with: ${popCommand}`;
|
|
381
1087
|
}
|
|
382
1088
|
function discardedChangesLine(count) {
|
|
383
1089
|
return `Discarded ${count} ${pluralNoun(count, "change")}.`;
|
|
@@ -390,11 +1096,11 @@ function applyWroteLine(input) {
|
|
|
390
1096
|
return input.unchanged !== void 0 ? `${CLI_COPY.everythingUpToDate} ${input.unchanged} unchanged.` : CLI_COPY.everythingUpToDate;
|
|
391
1097
|
}
|
|
392
1098
|
if (input.wrote === 0 && input.removed === 0) {
|
|
393
|
-
const
|
|
1099
|
+
const line2 = `Wrote 0, removed 0, kept ${input.kept}`;
|
|
394
1100
|
if (!input.omitUnchanged && input.unchanged !== void 0 && input.unchanged > 0) {
|
|
395
|
-
return `${
|
|
1101
|
+
return `${line2}, unchanged ${input.unchanged}.`;
|
|
396
1102
|
}
|
|
397
|
-
return `${
|
|
1103
|
+
return `${line2}.`;
|
|
398
1104
|
}
|
|
399
1105
|
const parts = [];
|
|
400
1106
|
if (input.wrote > 0) parts.push(`Wrote ${input.wrote}`);
|
|
@@ -407,7 +1113,7 @@ function applyWroteLine(input) {
|
|
|
407
1113
|
parts.push(`unchanged ${input.unchanged}`);
|
|
408
1114
|
}
|
|
409
1115
|
const [first, ...rest] = parts;
|
|
410
|
-
const head = first
|
|
1116
|
+
const head = first ? `${first.charAt(0).toUpperCase()}${first.slice(1)}` : "";
|
|
411
1117
|
if (rest.length === 0) {
|
|
412
1118
|
return `${head}.`;
|
|
413
1119
|
}
|
|
@@ -421,13 +1127,25 @@ function dryRunWouldLine(input) {
|
|
|
421
1127
|
return `Would write ${input.write}, remove ${input.remove}, keep ${input.keep}. ${input.unchanged} unchanged.`;
|
|
422
1128
|
}
|
|
423
1129
|
function dryRunStashLine(count, profileName) {
|
|
424
|
-
return `Dry run. Would stash ${count}
|
|
1130
|
+
return `Dry run. Would stash ${count} ${pluralNoun(count, "change")} from "${profileName}".`;
|
|
425
1131
|
}
|
|
426
1132
|
function snapshotSavedUndoLine(revertCommand) {
|
|
427
1133
|
return `${CLI_COPY.snapshotSavedUndo} ${revertCommand}`;
|
|
428
1134
|
}
|
|
429
1135
|
function keptFilesHeader(count) {
|
|
430
|
-
return `Kept ${count} ${CLI_COPY.keptFilesIntro}`;
|
|
1136
|
+
return `Kept ${count} ${pluralNoun(count, "file")} ${CLI_COPY.keptFilesIntro}`;
|
|
1137
|
+
}
|
|
1138
|
+
function keptReportedBeforeLine(count) {
|
|
1139
|
+
return `${count} more kept ${pluralNoun(count, "file")} in a plugin folder ${count === 1 ? "was" : "were"} listed by an earlier apply. \`ht profile status\` lists every kept file.`;
|
|
1140
|
+
}
|
|
1141
|
+
function keptLinkOutsideRoot(path) {
|
|
1142
|
+
return `Kept ${path}: it is your link to a file outside your home, and HarnessTap never writes through it.`;
|
|
1143
|
+
}
|
|
1144
|
+
function skippedRemovalOutsideRoot(path) {
|
|
1145
|
+
return `Skipped removing ${path} (a folder above it links outside your home).`;
|
|
1146
|
+
}
|
|
1147
|
+
function forceRemoveHintLine(count) {
|
|
1148
|
+
return `To remove ${count === 1 ? "it" : "them"} too, run the command again with --force-remove.`;
|
|
431
1149
|
}
|
|
432
1150
|
function restoredRemovedLine(restored, removed, options = {}) {
|
|
433
1151
|
if (options.dryRun) {
|
|
@@ -449,10 +1167,13 @@ function dryRunSectionHeader(kind, count) {
|
|
|
449
1167
|
}
|
|
450
1168
|
}
|
|
451
1169
|
}
|
|
452
|
-
function
|
|
1170
|
+
function isClaudePluginStorePath(path) {
|
|
1171
|
+
return path.replaceAll("\\", "/").startsWith(".claude/plugins/");
|
|
1172
|
+
}
|
|
1173
|
+
function keptReasonLabel(reason, path) {
|
|
453
1174
|
switch (reason) {
|
|
454
1175
|
case "modified":
|
|
455
|
-
return CLI_COPY.keptYouChanged;
|
|
1176
|
+
return path && isClaudePluginStorePath(path) ? CLI_COPY.keptClaudeChanged : CLI_COPY.keptYouChanged;
|
|
456
1177
|
case "unmanaged":
|
|
457
1178
|
return CLI_COPY.keptNotMade;
|
|
458
1179
|
default: {
|
|
@@ -488,6 +1209,24 @@ function reportNativeModuleMismatch(cause) {
|
|
|
488
1209
|
console.error(NATIVE_MODULE_MISMATCH_MESSAGE);
|
|
489
1210
|
process.exit(1);
|
|
490
1211
|
}
|
|
1212
|
+
function isSqliteModuleMissing(error) {
|
|
1213
|
+
if (!error || typeof error !== "object") {
|
|
1214
|
+
return false;
|
|
1215
|
+
}
|
|
1216
|
+
const err = error;
|
|
1217
|
+
const message = typeof err.message === "string" ? err.message : "";
|
|
1218
|
+
if (!message.includes("better-sqlite3") && !message.includes("better_sqlite3")) {
|
|
1219
|
+
return false;
|
|
1220
|
+
}
|
|
1221
|
+
return err.code === "MODULE_NOT_FOUND" || err.code === "ERR_MODULE_NOT_FOUND" || message.includes("Could not locate the bindings file") || message.includes("Cannot find module");
|
|
1222
|
+
}
|
|
1223
|
+
function reportSqliteModuleMissing(cause) {
|
|
1224
|
+
if (shouldShowNativeModuleDetails() && cause !== void 0) {
|
|
1225
|
+
console.error(cause);
|
|
1226
|
+
}
|
|
1227
|
+
console.error(SQLITE_MODULE_MISSING_MESSAGE);
|
|
1228
|
+
process.exit(1);
|
|
1229
|
+
}
|
|
491
1230
|
function withNativeModuleGuard(load) {
|
|
492
1231
|
try {
|
|
493
1232
|
return load();
|
|
@@ -495,6 +1234,9 @@ function withNativeModuleGuard(load) {
|
|
|
495
1234
|
if (isNativeModuleMismatch(error)) {
|
|
496
1235
|
reportNativeModuleMismatch(error);
|
|
497
1236
|
}
|
|
1237
|
+
if (isSqliteModuleMissing(error)) {
|
|
1238
|
+
reportSqliteModuleMissing(error);
|
|
1239
|
+
}
|
|
498
1240
|
throw error;
|
|
499
1241
|
}
|
|
500
1242
|
}
|
|
@@ -621,7 +1363,7 @@ function traceFs(kind, bytes = 0) {
|
|
|
621
1363
|
// src/db/write-generation.ts
|
|
622
1364
|
var statusWriteGeneration = 0;
|
|
623
1365
|
var WRITE_STATEMENT = /^\s*(?:WITH\b[\s\S]*?\b)?(INSERT|UPDATE|DELETE|REPLACE|CREATE|DROP|ALTER)\b/i;
|
|
624
|
-
var STATUS_IRRELEVANT_WRITE = /^\s*INSERT\s+INTO\s+resources\b/i;
|
|
1366
|
+
var STATUS_IRRELEVANT_WRITE = /^\s*(?:INSERT\s+INTO\s+resources\b|(?:INSERT\s+(?:OR\s+\w+\s+)?INTO|UPDATE|DELETE\s+FROM)\s+(?:upstream_checks|notifications)\b)/i;
|
|
625
1367
|
function statementAffectsStatus(sql) {
|
|
626
1368
|
if (!WRITE_STATEMENT.test(sql)) return false;
|
|
627
1369
|
return !STATUS_IRRELEVANT_WRITE.test(sql);
|
|
@@ -830,7 +1572,16 @@ function formatCatalogRequestError(error) {
|
|
|
830
1572
|
}
|
|
831
1573
|
|
|
832
1574
|
// src/utils/git-errors.ts
|
|
1575
|
+
var COMMAND_TIMED_OUT = /^Command timed out after (\d+)ms/;
|
|
1576
|
+
function isCommandTimeoutStderr(stderr) {
|
|
1577
|
+
return COMMAND_TIMED_OUT.test(stderr);
|
|
1578
|
+
}
|
|
833
1579
|
function mapGitStderr(stderr, url) {
|
|
1580
|
+
const timedOut = stderr.match(COMMAND_TIMED_OUT);
|
|
1581
|
+
if (timedOut) {
|
|
1582
|
+
const seconds = Math.max(1, Math.round(Number(timedOut[1]) / 1e3));
|
|
1583
|
+
return `Timed out after ${seconds}s reaching ${url ?? "that git repository"}.`;
|
|
1584
|
+
}
|
|
834
1585
|
if (stderr.startsWith("Couldn't reach")) {
|
|
835
1586
|
return stderr.endsWith(".") ? stderr : `${stderr}.`;
|
|
836
1587
|
}
|
|
@@ -844,13 +1595,49 @@ function gitFailureHint() {
|
|
|
844
1595
|
}
|
|
845
1596
|
|
|
846
1597
|
export {
|
|
847
|
-
|
|
1598
|
+
setHostPluginViewForceReplace,
|
|
1599
|
+
hostPluginViewForceReplace,
|
|
1600
|
+
recordKeptHostPluginViewFiles,
|
|
1601
|
+
recordReplacedHostPluginViewFiles,
|
|
1602
|
+
recordAddedHostPluginViewFiles,
|
|
1603
|
+
recordBlockedHostPluginViewFiles,
|
|
1604
|
+
takeBlockedHostPluginViewFiles,
|
|
1605
|
+
hasHostPluginViewNotices,
|
|
1606
|
+
hostPluginViewChangeCounts,
|
|
1607
|
+
takeReplacedHostPluginViewFiles,
|
|
1608
|
+
pendingKeptHostPluginViewPaths,
|
|
1609
|
+
allKeptHostPluginViewPaths,
|
|
1610
|
+
takeKeptHostPluginViewFiles,
|
|
1611
|
+
hostPluginViewNoticesJson,
|
|
848
1612
|
formatCount,
|
|
1613
|
+
shortenId,
|
|
1614
|
+
formatRelativeTime,
|
|
1615
|
+
formatRelativeTimeWithAbsolute,
|
|
1616
|
+
icons,
|
|
1617
|
+
styleResourceType,
|
|
1618
|
+
theme,
|
|
1619
|
+
isTty,
|
|
1620
|
+
terminalColumns,
|
|
1621
|
+
terminalRows,
|
|
1622
|
+
resolveTableMaxWidth,
|
|
1623
|
+
renderTable,
|
|
1624
|
+
table,
|
|
1625
|
+
renderPanel,
|
|
1626
|
+
panel,
|
|
1627
|
+
kvBlock,
|
|
1628
|
+
createProgress,
|
|
1629
|
+
status,
|
|
1630
|
+
renderSubheader,
|
|
1631
|
+
subheader,
|
|
1632
|
+
ui,
|
|
849
1633
|
isReleaseBuild,
|
|
850
1634
|
readGitSha,
|
|
851
1635
|
formatDevBuildVersion,
|
|
852
1636
|
resolveBuildVersion,
|
|
853
1637
|
PACKAGE_VERSION,
|
|
1638
|
+
CliUsageError,
|
|
1639
|
+
missingRequiredArg,
|
|
1640
|
+
conflictingOptions,
|
|
854
1641
|
quoteCliArg,
|
|
855
1642
|
formatHtCommand,
|
|
856
1643
|
skippedInvalidPluginExport,
|
|
@@ -889,13 +1676,19 @@ export {
|
|
|
889
1676
|
dryRunStashLine,
|
|
890
1677
|
snapshotSavedUndoLine,
|
|
891
1678
|
keptFilesHeader,
|
|
1679
|
+
keptReportedBeforeLine,
|
|
1680
|
+
keptLinkOutsideRoot,
|
|
1681
|
+
skippedRemovalOutsideRoot,
|
|
1682
|
+
forceRemoveHintLine,
|
|
892
1683
|
restoredRemovedLine,
|
|
893
1684
|
dryRunSectionHeader,
|
|
894
1685
|
keptReasonLabel,
|
|
1686
|
+
isCommandTimeoutStderr,
|
|
895
1687
|
mapGitStderr,
|
|
896
1688
|
gitFailureHint,
|
|
897
1689
|
isNativeModuleMismatch,
|
|
898
1690
|
reportNativeModuleMismatch,
|
|
1691
|
+
isSqliteModuleMissing,
|
|
899
1692
|
statusTraceEnabled,
|
|
900
1693
|
traceSpan,
|
|
901
1694
|
traceCount,
|
|
@@ -911,4 +1704,4 @@ export {
|
|
|
911
1704
|
fetchWithTimeout,
|
|
912
1705
|
formatCatalogRequestError
|
|
913
1706
|
};
|
|
914
|
-
//# sourceMappingURL=chunk-
|
|
1707
|
+
//# sourceMappingURL=chunk-OHZNDV4A.js.map
|