harnesstap 1.2.0 → 1.3.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 +28 -15
- package/dist/apply-QSS4242W.js +67 -0
- package/dist/apply-QSS4242W.js.map +1 -0
- package/dist/approve-CNYQY6DC.js +181 -0
- package/dist/approve-CNYQY6DC.js.map +1 -0
- package/dist/audit-V4SUV7KA.js +434 -0
- package/dist/audit-V4SUV7KA.js.map +1 -0
- package/dist/auth-63FOHIQ3.js +220 -0
- package/dist/auth-63FOHIQ3.js.map +1 -0
- package/dist/bin.js +166 -0
- package/dist/bin.js.map +1 -0
- package/dist/chunk-2H7UOFLK.js +11 -0
- package/dist/chunk-2H7UOFLK.js.map +1 -0
- package/dist/chunk-2NE3QYMP.js +103 -0
- package/dist/chunk-2NE3QYMP.js.map +1 -0
- package/dist/chunk-2P2EOYEW.js +1140 -0
- package/dist/chunk-2P2EOYEW.js.map +1 -0
- package/dist/chunk-37E5M4JX.js +34 -0
- package/dist/chunk-37E5M4JX.js.map +1 -0
- package/dist/chunk-37LQQWMF.js +496 -0
- package/dist/chunk-37LQQWMF.js.map +1 -0
- package/dist/chunk-3FIWOI3H.js +98 -0
- package/dist/chunk-3FIWOI3H.js.map +1 -0
- package/dist/chunk-3PGC6OA3.js +540 -0
- package/dist/chunk-3PGC6OA3.js.map +1 -0
- package/dist/chunk-4IHKBIY3.js +118 -0
- package/dist/chunk-4IHKBIY3.js.map +1 -0
- package/dist/chunk-4ZUBRLSP.js +17 -0
- package/dist/chunk-4ZUBRLSP.js.map +1 -0
- package/dist/chunk-5F3LNDZG.js +9 -0
- package/dist/chunk-5F3LNDZG.js.map +1 -0
- package/dist/chunk-5TXI6BI2.js +1359 -0
- package/dist/chunk-5TXI6BI2.js.map +1 -0
- package/dist/chunk-6P5IO4BX.js +235 -0
- package/dist/chunk-6P5IO4BX.js.map +1 -0
- package/dist/chunk-ABXUKHAU.js +571 -0
- package/dist/chunk-ABXUKHAU.js.map +1 -0
- package/dist/chunk-AOUDSNRK.js +1357 -0
- package/dist/chunk-AOUDSNRK.js.map +1 -0
- package/dist/chunk-BNDJJAEI.js +311 -0
- package/dist/chunk-BNDJJAEI.js.map +1 -0
- package/dist/chunk-C2IWSFF5.js +818 -0
- package/dist/chunk-C2IWSFF5.js.map +1 -0
- package/dist/chunk-CHQGE2HF.js +283 -0
- package/dist/chunk-CHQGE2HF.js.map +1 -0
- package/dist/chunk-DEJLP7QJ.js +681 -0
- package/dist/chunk-DEJLP7QJ.js.map +1 -0
- package/dist/chunk-DJ6FN6EW.js +532 -0
- package/dist/chunk-DJ6FN6EW.js.map +1 -0
- package/dist/chunk-E4WRTRMH.js +1173 -0
- package/dist/chunk-E4WRTRMH.js.map +1 -0
- package/dist/chunk-E5QXNU3K.js +238 -0
- package/dist/chunk-E5QXNU3K.js.map +1 -0
- package/dist/chunk-EMTBGOR3.js +2959 -0
- package/dist/chunk-EMTBGOR3.js.map +1 -0
- package/dist/chunk-FFWYIGQ4.js +18 -0
- package/dist/chunk-FFWYIGQ4.js.map +1 -0
- package/dist/chunk-I6XFZLTJ.js +9 -0
- package/dist/chunk-I6XFZLTJ.js.map +1 -0
- package/dist/chunk-IHWAOIAU.js +172 -0
- package/dist/chunk-IHWAOIAU.js.map +1 -0
- package/dist/chunk-IHZUYG66.js +583 -0
- package/dist/chunk-IHZUYG66.js.map +1 -0
- package/dist/chunk-JQOKQKQT.js +158 -0
- package/dist/chunk-JQOKQKQT.js.map +1 -0
- package/dist/chunk-JRFUTIEH.js +426 -0
- package/dist/chunk-JRFUTIEH.js.map +1 -0
- package/dist/chunk-KCBI6JQC.js +115 -0
- package/dist/chunk-KCBI6JQC.js.map +1 -0
- package/dist/chunk-KDUQMINL.js +60 -0
- package/dist/chunk-KDUQMINL.js.map +1 -0
- package/dist/chunk-KLR2DURP.js +656 -0
- package/dist/chunk-KLR2DURP.js.map +1 -0
- package/dist/chunk-KRI4R7EM.js +25 -0
- package/dist/chunk-KRI4R7EM.js.map +1 -0
- package/dist/chunk-LYQMK6SV.js +87 -0
- package/dist/chunk-LYQMK6SV.js.map +1 -0
- package/dist/chunk-MK3Q37ZN.js +183 -0
- package/dist/chunk-MK3Q37ZN.js.map +1 -0
- package/dist/chunk-MSGAGV7B.js +346 -0
- package/dist/chunk-MSGAGV7B.js.map +1 -0
- package/dist/chunk-MZQRSERO.js +430 -0
- package/dist/chunk-MZQRSERO.js.map +1 -0
- package/dist/chunk-N3WIJXXM.js +691 -0
- package/dist/chunk-N3WIJXXM.js.map +1 -0
- package/dist/chunk-NAGAJ5UM.js +145 -0
- package/dist/chunk-NAGAJ5UM.js.map +1 -0
- package/dist/chunk-NFYPBTKO.js +302 -0
- package/dist/chunk-NFYPBTKO.js.map +1 -0
- package/dist/chunk-NPO2IG6G.js +491 -0
- package/dist/chunk-NPO2IG6G.js.map +1 -0
- package/dist/chunk-OS6NUIBJ.js +38 -0
- package/dist/chunk-OS6NUIBJ.js.map +1 -0
- package/dist/chunk-PFUK3HJ4.js +296 -0
- package/dist/chunk-PFUK3HJ4.js.map +1 -0
- package/dist/chunk-PMQ55GDB.js +115 -0
- package/dist/chunk-PMQ55GDB.js.map +1 -0
- package/dist/chunk-QIVE2YFJ.js +514 -0
- package/dist/chunk-QIVE2YFJ.js.map +1 -0
- package/dist/chunk-QKXD3EUF.js +691 -0
- package/dist/chunk-QKXD3EUF.js.map +1 -0
- package/dist/chunk-RNQYUWF6.js +32 -0
- package/dist/chunk-RNQYUWF6.js.map +1 -0
- package/dist/chunk-S2E4SSQV.js +41 -0
- package/dist/chunk-S2E4SSQV.js.map +1 -0
- package/dist/chunk-SN4BXX3B.js +186 -0
- package/dist/chunk-SN4BXX3B.js.map +1 -0
- package/dist/chunk-SNVAMWB7.js +40 -0
- package/dist/chunk-SNVAMWB7.js.map +1 -0
- package/dist/chunk-T5VRREN4.js +696 -0
- package/dist/chunk-T5VRREN4.js.map +1 -0
- package/dist/chunk-TKBMHZTS.js +10945 -0
- package/dist/chunk-TKBMHZTS.js.map +1 -0
- package/dist/chunk-TNJPTUE4.js +35 -0
- package/dist/chunk-TNJPTUE4.js.map +1 -0
- package/dist/chunk-TQ2NA4Z4.js +24 -0
- package/dist/chunk-TQ2NA4Z4.js.map +1 -0
- package/dist/chunk-TXXDMDPN.js +998 -0
- package/dist/chunk-TXXDMDPN.js.map +1 -0
- package/dist/chunk-UWXUBU7V.js +184 -0
- package/dist/chunk-UWXUBU7V.js.map +1 -0
- package/dist/chunk-UYRK2H24.js +141 -0
- package/dist/chunk-UYRK2H24.js.map +1 -0
- package/dist/chunk-V4IXIM3C.js +806 -0
- package/dist/chunk-V4IXIM3C.js.map +1 -0
- package/dist/chunk-VFHVXXP4.js +6438 -0
- package/dist/chunk-VFHVXXP4.js.map +1 -0
- package/dist/chunk-VQVUJYYY.js +244 -0
- package/dist/chunk-VQVUJYYY.js.map +1 -0
- package/dist/chunk-VZQG2JDV.js +9 -0
- package/dist/chunk-VZQG2JDV.js.map +1 -0
- package/dist/chunk-W7HQ5X3S.js +610 -0
- package/dist/chunk-W7HQ5X3S.js.map +1 -0
- package/dist/chunk-WMSQAFK5.js +65 -0
- package/dist/chunk-WMSQAFK5.js.map +1 -0
- package/dist/chunk-WMYTBJPB.js +364 -0
- package/dist/chunk-WMYTBJPB.js.map +1 -0
- package/dist/chunk-WNLFNCOH.js +7795 -0
- package/dist/chunk-WNLFNCOH.js.map +1 -0
- package/dist/chunk-WRX7CB2M.js +6448 -0
- package/dist/chunk-WRX7CB2M.js.map +1 -0
- package/dist/chunk-XGTTOO4R.js +84 -0
- package/dist/chunk-XGTTOO4R.js.map +1 -0
- package/dist/chunk-YSXRBUR4.js +682 -0
- package/dist/chunk-YSXRBUR4.js.map +1 -0
- package/dist/chunk-YTC2EG64.js +1759 -0
- package/dist/chunk-YTC2EG64.js.map +1 -0
- package/dist/compile-J3UGQSS3.js +161 -0
- package/dist/compile-J3UGQSS3.js.map +1 -0
- package/dist/config-5BPSZND3.js +438 -0
- package/dist/config-5BPSZND3.js.map +1 -0
- package/dist/doctor-BVFKLJVO.js +111 -0
- package/dist/doctor-BVFKLJVO.js.map +1 -0
- package/dist/environment-3RI5H32O.js +2745 -0
- package/dist/environment-3RI5H32O.js.map +1 -0
- package/dist/github-YFJQVH5K.js +114 -0
- package/dist/github-YFJQVH5K.js.map +1 -0
- package/dist/harness-ECGHPEKA.js +746 -0
- package/dist/harness-ECGHPEKA.js.map +1 -0
- package/dist/help-ELPNPPEM.js +2079 -0
- package/dist/help-ELPNPPEM.js.map +1 -0
- package/dist/help-UL5XLY3I.js +1892 -0
- package/dist/help-UL5XLY3I.js.map +1 -0
- package/dist/index.d.ts +164 -1
- package/dist/index.js +50 -59246
- package/dist/index.js.map +1 -1
- package/dist/init-UJQTDHW7.js +873 -0
- package/dist/init-UJQTDHW7.js.map +1 -0
- package/dist/lock-XUMJ63NZ.js +455 -0
- package/dist/lock-XUMJ63NZ.js.map +1 -0
- package/dist/marketplace-ZUMOLVXE.js +495 -0
- package/dist/marketplace-ZUMOLVXE.js.map +1 -0
- package/dist/mcp-RZA5O2ND.js +202 -0
- package/dist/mcp-RZA5O2ND.js.map +1 -0
- package/dist/migrate-CYQI2FH6.js +1043 -0
- package/dist/migrate-CYQI2FH6.js.map +1 -0
- package/dist/open-AWOAWLKO.js +32 -0
- package/dist/open-AWOAWLKO.js.map +1 -0
- package/dist/pack-2QD5ZUIO.js +99 -0
- package/dist/pack-2QD5ZUIO.js.map +1 -0
- package/dist/plugin-GQSSSFX4.js +64 -0
- package/dist/plugin-GQSSSFX4.js.map +1 -0
- package/dist/plugin-from-project-SIQUFYIO.js +16 -0
- package/dist/plugin-from-project-SIQUFYIO.js.map +1 -0
- package/dist/policy-CT4JRCJI.js +105 -0
- package/dist/policy-CT4JRCJI.js.map +1 -0
- package/dist/profile-4JQ6LECP.js +1886 -0
- package/dist/profile-4JQ6LECP.js.map +1 -0
- package/dist/project-JG7QWXRG.js +1392 -0
- package/dist/project-JG7QWXRG.js.map +1 -0
- package/dist/resource-QRMR6CSD.js +555 -0
- package/dist/resource-QRMR6CSD.js.map +1 -0
- package/dist/version-LZ5POOXY.js +17 -0
- package/dist/version-LZ5POOXY.js.map +1 -0
- package/package.json +21 -14
- package/schemas/ap-package.v1.json +36 -0
- package/schemas/fixtures/catalog-missing-schema.ap.json +13 -0
- package/schemas/fixtures/confidence.ap.json +13 -0
- package/schemas/fixtures/context7.ap.json +13 -0
- package/schemas/fixtures/minimal-with-schema.ap.json +13 -0
- package/schemas/fixtures/superpowers.ap.json +13 -0
- package/schemas/fixtures/third-party-skills.ap.json +13 -0
|
@@ -0,0 +1,696 @@
|
|
|
1
|
+
import {
|
|
2
|
+
matchesListSearchQuery,
|
|
3
|
+
parseListSearchQuery
|
|
4
|
+
} from "./chunk-KRI4R7EM.js";
|
|
5
|
+
import {
|
|
6
|
+
VIEWPORT_CHROME_LINES,
|
|
7
|
+
computeMaxVisibleTableRows,
|
|
8
|
+
renderFoldedHintLine,
|
|
9
|
+
resolveSectionViewport
|
|
10
|
+
} from "./chunk-XGTTOO4R.js";
|
|
11
|
+
import {
|
|
12
|
+
formatHookInventoryLabel,
|
|
13
|
+
hookDisplayInputFromResource
|
|
14
|
+
} from "./chunk-E5QXNU3K.js";
|
|
15
|
+
import {
|
|
16
|
+
RESOURCE_TYPES,
|
|
17
|
+
getAllPlatforms
|
|
18
|
+
} from "./chunk-TKBMHZTS.js";
|
|
19
|
+
import {
|
|
20
|
+
formatRelativeTime,
|
|
21
|
+
renderTable,
|
|
22
|
+
resolveTableMaxWidth,
|
|
23
|
+
shortenId,
|
|
24
|
+
theme
|
|
25
|
+
} from "./chunk-ABXUKHAU.js";
|
|
26
|
+
|
|
27
|
+
// src/ui/resource-display.ts
|
|
28
|
+
var AGENTS_INSTRUCTIONS_RESOURCE_NAME = "agents-instructions";
|
|
29
|
+
var GLOBAL_SCOPE_LABEL = "global";
|
|
30
|
+
var SHARED_INSTRUCTION_SCOPE_LABEL = "shared";
|
|
31
|
+
var LOCAL_ORIGIN_KINDS = /* @__PURE__ */ new Set(["local", "local_snapshot", "manual"]);
|
|
32
|
+
var ORIGIN_KIND_LABELS = {
|
|
33
|
+
local: "Local",
|
|
34
|
+
marketplace_link: "Marketplace",
|
|
35
|
+
untracked: "Untracked"
|
|
36
|
+
};
|
|
37
|
+
var PACKAGE_ENTRY_FILE_NAMES = /* @__PURE__ */ new Set(["skill.md", "plugin.json"]);
|
|
38
|
+
function groupedOriginKind(originKind) {
|
|
39
|
+
if (LOCAL_ORIGIN_KINDS.has(originKind)) {
|
|
40
|
+
return "local";
|
|
41
|
+
}
|
|
42
|
+
return originKind;
|
|
43
|
+
}
|
|
44
|
+
function formatOriginKindLabel(originKind) {
|
|
45
|
+
const grouped = groupedOriginKind(originKind);
|
|
46
|
+
return ORIGIN_KIND_LABELS[grouped] ?? grouped.replaceAll("_", " ");
|
|
47
|
+
}
|
|
48
|
+
function formatOriginDisplayLabel(originKind, originRef, options) {
|
|
49
|
+
const kind = formatOriginKindLabel(originKind);
|
|
50
|
+
const includeRef = options?.includeRef ?? true;
|
|
51
|
+
const ref = originRef?.trim() ?? "";
|
|
52
|
+
if (!includeRef || !ref) {
|
|
53
|
+
return kind;
|
|
54
|
+
}
|
|
55
|
+
return `${kind} (${ref})`;
|
|
56
|
+
}
|
|
57
|
+
function isAgentsMdResource(resource) {
|
|
58
|
+
if (resource.name === AGENTS_INSTRUCTIONS_RESOURCE_NAME) {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
const source = (resource.source ?? "").replaceAll("\\", "/").replace(/\/+$/, "");
|
|
62
|
+
if (!source) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
return source === "AGENTS.md" || source.endsWith("/AGENTS.md");
|
|
66
|
+
}
|
|
67
|
+
function instructionFileName(resource) {
|
|
68
|
+
const source = (resource.source ?? "").replaceAll("\\", "/");
|
|
69
|
+
if (source) {
|
|
70
|
+
const base = source.split("/").filter(Boolean).at(-1);
|
|
71
|
+
if (base) {
|
|
72
|
+
return base;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (isAgentsMdResource(resource)) {
|
|
76
|
+
return "AGENTS.md";
|
|
77
|
+
}
|
|
78
|
+
if (resource.name === "claude-instructions") {
|
|
79
|
+
return "CLAUDE.md";
|
|
80
|
+
}
|
|
81
|
+
if (resource.name.endsWith("-instructions")) {
|
|
82
|
+
return "AGENTS.md";
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
function platformNameForInstructionResource(name) {
|
|
87
|
+
if (!name.endsWith("-instructions") || name === AGENTS_INSTRUCTIONS_RESOURCE_NAME) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
const prefix = name.slice(0, -"-instructions".length);
|
|
91
|
+
const platforms = getAllPlatforms();
|
|
92
|
+
const exact = platforms.find((platform) => platform.id === prefix);
|
|
93
|
+
if (exact) {
|
|
94
|
+
return exact.name;
|
|
95
|
+
}
|
|
96
|
+
const withCli = platforms.find((platform) => platform.id === `${prefix}-cli`);
|
|
97
|
+
if (withCli) {
|
|
98
|
+
return withCli.name;
|
|
99
|
+
}
|
|
100
|
+
const withCode = platforms.find(
|
|
101
|
+
(platform) => platform.id === `${prefix}-code` || platform.id.startsWith(`${prefix}-`)
|
|
102
|
+
);
|
|
103
|
+
if (withCode) {
|
|
104
|
+
return withCode.name;
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
function instructionQualifier(resource) {
|
|
109
|
+
const namespace = resource.namespace?.trim() ?? "";
|
|
110
|
+
if (namespace.length > 0 && namespace !== GLOBAL_SCOPE_LABEL) {
|
|
111
|
+
return namespace;
|
|
112
|
+
}
|
|
113
|
+
const fromName = platformNameForInstructionResource(resource.name);
|
|
114
|
+
if (fromName) {
|
|
115
|
+
return fromName;
|
|
116
|
+
}
|
|
117
|
+
return SHARED_INSTRUCTION_SCOPE_LABEL;
|
|
118
|
+
}
|
|
119
|
+
function formatInstructionInventoryLabel(resource) {
|
|
120
|
+
const file = instructionFileName(resource);
|
|
121
|
+
if (!file) {
|
|
122
|
+
return resource.name;
|
|
123
|
+
}
|
|
124
|
+
return `${file} (${instructionQualifier(resource)})`;
|
|
125
|
+
}
|
|
126
|
+
function resourceHumanName(resource) {
|
|
127
|
+
if (resource.type === "instruction" || isAgentsMdResource(resource)) {
|
|
128
|
+
return formatInstructionInventoryLabel(resource);
|
|
129
|
+
}
|
|
130
|
+
if (resource.type === "hook") {
|
|
131
|
+
return formatHookInventoryLabel(hookDisplayInputFromResource(resource));
|
|
132
|
+
}
|
|
133
|
+
return resource.name;
|
|
134
|
+
}
|
|
135
|
+
function duplicatePluginNames(resources) {
|
|
136
|
+
const counts = /* @__PURE__ */ new Map();
|
|
137
|
+
for (const resource of resources) {
|
|
138
|
+
if (resource.type !== "plugin" || resource.listKind === "plugin-package") {
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
const name = resource.name.trim();
|
|
142
|
+
if (!name) {
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
counts.set(name, (counts.get(name) ?? 0) + 1);
|
|
146
|
+
}
|
|
147
|
+
const duplicates = /* @__PURE__ */ new Set();
|
|
148
|
+
for (const [name, count] of counts) {
|
|
149
|
+
if (count >= 2) {
|
|
150
|
+
duplicates.add(name);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return duplicates;
|
|
154
|
+
}
|
|
155
|
+
function formatResourceDisplayName(resource, options) {
|
|
156
|
+
const base = resourceHumanName(resource);
|
|
157
|
+
if (resource.type === "instruction" || isAgentsMdResource(resource)) {
|
|
158
|
+
return base;
|
|
159
|
+
}
|
|
160
|
+
if (resource.type === "plugin") {
|
|
161
|
+
if (!options?.disambiguatePlugin) {
|
|
162
|
+
return base;
|
|
163
|
+
}
|
|
164
|
+
const ref = resource.origin_ref?.trim() ?? "";
|
|
165
|
+
if (ref.includes("@")) {
|
|
166
|
+
return ref;
|
|
167
|
+
}
|
|
168
|
+
const marketplace = resource.namespace?.trim() ?? "";
|
|
169
|
+
return marketplace ? `${base}@${marketplace}` : base;
|
|
170
|
+
}
|
|
171
|
+
const namespace = resource.namespace?.trim() ?? "";
|
|
172
|
+
return namespace ? `${base}@${namespace}` : base;
|
|
173
|
+
}
|
|
174
|
+
function formatResourceScopeLabel(namespace) {
|
|
175
|
+
const ns = namespace?.trim() ?? "";
|
|
176
|
+
return ns.length > 0 ? ns : GLOBAL_SCOPE_LABEL;
|
|
177
|
+
}
|
|
178
|
+
function isPackageEntryFileName(fileName) {
|
|
179
|
+
return PACKAGE_ENTRY_FILE_NAMES.has(fileName.trim().toLowerCase());
|
|
180
|
+
}
|
|
181
|
+
function packageDirectoryDisplayPath(path) {
|
|
182
|
+
const trimmed = path.trim();
|
|
183
|
+
if (!trimmed) {
|
|
184
|
+
return trimmed;
|
|
185
|
+
}
|
|
186
|
+
const hasBackslash = trimmed.includes("\\") && !trimmed.includes("/");
|
|
187
|
+
const separator = hasBackslash ? "\\" : "/";
|
|
188
|
+
const normalized = trimmed.replace(/[\\/]+$/, "");
|
|
189
|
+
const parts = normalized.split(/[/\\]/);
|
|
190
|
+
const fileName = parts[parts.length - 1] ?? "";
|
|
191
|
+
if (!isPackageEntryFileName(fileName) || parts.length < 2) {
|
|
192
|
+
return trimmed;
|
|
193
|
+
}
|
|
194
|
+
return parts.slice(0, -1).join(separator);
|
|
195
|
+
}
|
|
196
|
+
function inferContainedFileType(relativePath) {
|
|
197
|
+
const top = relativePath.split("/")[0] ?? "";
|
|
198
|
+
switch (top) {
|
|
199
|
+
case "skills":
|
|
200
|
+
return "skill";
|
|
201
|
+
case "agents":
|
|
202
|
+
return "agent";
|
|
203
|
+
case "rules":
|
|
204
|
+
return "rule";
|
|
205
|
+
case "commands":
|
|
206
|
+
return "command";
|
|
207
|
+
case "hooks":
|
|
208
|
+
return "hook";
|
|
209
|
+
case "mcp":
|
|
210
|
+
return "mcp_server";
|
|
211
|
+
default:
|
|
212
|
+
return "file";
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
function containedFileStem(relativePath) {
|
|
216
|
+
const base = relativePath.split("/").at(-1) ?? relativePath;
|
|
217
|
+
const dot = base.lastIndexOf(".");
|
|
218
|
+
if (dot <= 0) {
|
|
219
|
+
return base;
|
|
220
|
+
}
|
|
221
|
+
return base.slice(0, dot);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// src/ui/resource-list-render.ts
|
|
225
|
+
var DEFAULT_RESOURCE_LIST_PER_TYPE_LIMIT = 10;
|
|
226
|
+
function formatResourceListNamespace(resource) {
|
|
227
|
+
const ns = resource.namespace.trim();
|
|
228
|
+
if (!ns) return formatResourceScopeLabel(ns);
|
|
229
|
+
if (resource.origin_kind === "marketplace_link" && resource.origin_ref.includes("@")) {
|
|
230
|
+
const [plugin, marketplace] = resource.origin_ref.split("@", 2);
|
|
231
|
+
if (plugin && marketplace && ns === plugin) {
|
|
232
|
+
return `${marketplace}/${plugin}`;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return ns;
|
|
236
|
+
}
|
|
237
|
+
function hasListNamespace(rows) {
|
|
238
|
+
return rows.some((row) => formatResourceListNamespace(row).length > 0);
|
|
239
|
+
}
|
|
240
|
+
function sectionCount(navigable, type) {
|
|
241
|
+
return navigable.filter((row) => row.type === type).length;
|
|
242
|
+
}
|
|
243
|
+
function resolveActiveSectionContext(navigable, active) {
|
|
244
|
+
const selected = navigable[active];
|
|
245
|
+
if (!selected) {
|
|
246
|
+
return { type: "skill", indexInSection: 0, sectionRows: [] };
|
|
247
|
+
}
|
|
248
|
+
const type = selected.type;
|
|
249
|
+
const sectionRows = navigable.filter((row) => row.type === type);
|
|
250
|
+
const indexInSection = sectionRows.findIndex((row) => row.id === selected.id);
|
|
251
|
+
const typeIndex = RESOURCE_TYPES.indexOf(type);
|
|
252
|
+
const prevSection = RESOURCE_TYPES.slice(0, typeIndex).reverse().map((sectionType) => ({
|
|
253
|
+
type: sectionType,
|
|
254
|
+
count: sectionCount(navigable, sectionType)
|
|
255
|
+
})).find((section) => section.count > 0);
|
|
256
|
+
const nextSection = RESOURCE_TYPES.slice(typeIndex + 1).map((sectionType) => ({
|
|
257
|
+
type: sectionType,
|
|
258
|
+
count: sectionCount(navigable, sectionType)
|
|
259
|
+
})).find((section) => section.count > 0);
|
|
260
|
+
return { type, indexInSection, sectionRows, prevSection, nextSection };
|
|
261
|
+
}
|
|
262
|
+
function clampIndex(index, length) {
|
|
263
|
+
if (length === 0) return 0;
|
|
264
|
+
return Math.max(0, Math.min(index, length - 1));
|
|
265
|
+
}
|
|
266
|
+
function buildResourceViewportHintSegments(ctx, viewport) {
|
|
267
|
+
const segments = [];
|
|
268
|
+
const hiddenBelow = ctx.sectionRows.length - viewport.end;
|
|
269
|
+
const hiddenAbove = viewport.start;
|
|
270
|
+
if (hiddenAbove > 0) {
|
|
271
|
+
segments.push(`\u2191 ${hiddenAbove} above`);
|
|
272
|
+
}
|
|
273
|
+
if (hiddenBelow > 0) {
|
|
274
|
+
segments.push(`\u2193 ${hiddenBelow} more in ${ctx.type}`);
|
|
275
|
+
}
|
|
276
|
+
if (ctx.nextSection) {
|
|
277
|
+
segments.push(`${ctx.nextSection.type} (${ctx.nextSection.count})`);
|
|
278
|
+
segments.push("\u2193 next type");
|
|
279
|
+
}
|
|
280
|
+
if (viewport.start === 0 && ctx.prevSection) {
|
|
281
|
+
segments.push(`${ctx.prevSection.type} (${ctx.prevSection.count})`);
|
|
282
|
+
segments.push("\u2191 prev type");
|
|
283
|
+
}
|
|
284
|
+
return segments;
|
|
285
|
+
}
|
|
286
|
+
function renderViewportOverflowHints(ctx, viewport, maxWidth) {
|
|
287
|
+
const folded = renderFoldedHintLine(
|
|
288
|
+
buildResourceViewportHintSegments(ctx, viewport),
|
|
289
|
+
maxWidth
|
|
290
|
+
);
|
|
291
|
+
return folded.length > 0 ? theme.muted(folded) : "";
|
|
292
|
+
}
|
|
293
|
+
function renderGroupedResourceListViewport(resources, opts) {
|
|
294
|
+
if (resources.length === 0) {
|
|
295
|
+
return "No resources found.";
|
|
296
|
+
}
|
|
297
|
+
const ctx = resolveActiveSectionContext(opts.navigable, opts.activeIndex);
|
|
298
|
+
if (ctx.sectionRows.length === 0) {
|
|
299
|
+
return "No resources found.";
|
|
300
|
+
}
|
|
301
|
+
const maxVisibleRows = computeMaxVisibleTableRows(
|
|
302
|
+
opts.terminalRows,
|
|
303
|
+
VIEWPORT_CHROME_LINES.resourceList
|
|
304
|
+
);
|
|
305
|
+
const viewport = resolveSectionViewport(
|
|
306
|
+
ctx.sectionRows.length,
|
|
307
|
+
ctx.indexInSection,
|
|
308
|
+
maxVisibleRows
|
|
309
|
+
);
|
|
310
|
+
const visibleRows = ctx.sectionRows.slice(viewport.start, viewport.end);
|
|
311
|
+
const hasNamespace = hasListNamespace(visibleRows);
|
|
312
|
+
const columns = makeResourceListColumns(opts.showId, false, hasNamespace, true);
|
|
313
|
+
const maxWidth = resolveTableMaxWidth(opts.maxWidth);
|
|
314
|
+
return [
|
|
315
|
+
renderResourceTypeSubheader(ctx.type, ctx.sectionRows.length),
|
|
316
|
+
renderTable({
|
|
317
|
+
columns,
|
|
318
|
+
rows: decorateRowsForSelection(visibleRows, opts.selectedResourceId),
|
|
319
|
+
...resourceListTableLayout(opts)
|
|
320
|
+
}),
|
|
321
|
+
renderViewportOverflowHints(ctx, viewport, maxWidth)
|
|
322
|
+
].filter((line) => line.length > 0).join("\n");
|
|
323
|
+
}
|
|
324
|
+
function renderGroupedPluginEditViewport(rows, opts) {
|
|
325
|
+
if (rows.length === 0) {
|
|
326
|
+
return "No resources found.";
|
|
327
|
+
}
|
|
328
|
+
const ctx = resolveActiveSectionContext(opts.navigable, opts.activeIndex);
|
|
329
|
+
if (ctx.sectionRows.length === 0) {
|
|
330
|
+
return "No resources found.";
|
|
331
|
+
}
|
|
332
|
+
const maxVisibleRows = computeMaxVisibleTableRows(
|
|
333
|
+
opts.terminalRows,
|
|
334
|
+
VIEWPORT_CHROME_LINES.pluginEdit
|
|
335
|
+
);
|
|
336
|
+
const viewport = resolveSectionViewport(
|
|
337
|
+
ctx.sectionRows.length,
|
|
338
|
+
ctx.indexInSection,
|
|
339
|
+
maxVisibleRows
|
|
340
|
+
);
|
|
341
|
+
const visibleRows = ctx.sectionRows.slice(viewport.start, viewport.end);
|
|
342
|
+
const hasNamespace = hasListNamespace(visibleRows);
|
|
343
|
+
const columns = makeResourceListColumns(opts.showId, false, hasNamespace, true);
|
|
344
|
+
const checkedCount = rows.filter((row) => row.checked).length;
|
|
345
|
+
const maxWidth = resolveTableMaxWidth(opts.maxWidth);
|
|
346
|
+
return [
|
|
347
|
+
renderResourceTypeSubheader(ctx.type, ctx.sectionRows.length),
|
|
348
|
+
renderTable({
|
|
349
|
+
columns,
|
|
350
|
+
rows: decorateRowsForCheckboxes(visibleRows, opts),
|
|
351
|
+
...resourceListTableLayout(opts)
|
|
352
|
+
}),
|
|
353
|
+
renderViewportOverflowHints(ctx, viewport, maxWidth),
|
|
354
|
+
"",
|
|
355
|
+
theme.info(`${checkedCount} selected \u2022 ${rows.length} resources`)
|
|
356
|
+
].filter((line) => line.length > 0).join("\n");
|
|
357
|
+
}
|
|
358
|
+
function renderFlatPluginEditViewport(rows, opts) {
|
|
359
|
+
if (rows.length === 0) {
|
|
360
|
+
return "No resources found.";
|
|
361
|
+
}
|
|
362
|
+
const maxVisibleRows = computeMaxVisibleTableRows(
|
|
363
|
+
opts.terminalRows,
|
|
364
|
+
VIEWPORT_CHROME_LINES.pluginEdit
|
|
365
|
+
);
|
|
366
|
+
const activeIndex = clampIndex(opts.activeIndex, opts.navigable.length);
|
|
367
|
+
const viewport = resolveSectionViewport(
|
|
368
|
+
opts.navigable.length,
|
|
369
|
+
activeIndex,
|
|
370
|
+
maxVisibleRows
|
|
371
|
+
);
|
|
372
|
+
const visibleRows = opts.navigable.slice(viewport.start, viewport.end);
|
|
373
|
+
const hasNamespace = hasListNamespace(visibleRows);
|
|
374
|
+
const activeRowId = opts.navigable[activeIndex]?.id;
|
|
375
|
+
const checkedCount = rows.filter((row) => row.checked).length;
|
|
376
|
+
const hints = [];
|
|
377
|
+
if (viewport.start > 0) {
|
|
378
|
+
hints.push(theme.muted(` \u2191 ${viewport.start} above`));
|
|
379
|
+
}
|
|
380
|
+
if (viewport.end < opts.navigable.length) {
|
|
381
|
+
hints.push(theme.muted(` \u2193 ${opts.navigable.length - viewport.end} more`));
|
|
382
|
+
}
|
|
383
|
+
return [
|
|
384
|
+
renderTable({
|
|
385
|
+
columns: makeResourceListColumns(opts.showId, false, hasNamespace, true),
|
|
386
|
+
rows: decorateRowsForCheckboxes(visibleRows, { ...opts, activeRowId }),
|
|
387
|
+
summary: `${checkedCount} selected ${theme.muted(`(${opts.navigable.length} resources)`)}`,
|
|
388
|
+
...resourceListTableLayout(opts)
|
|
389
|
+
}),
|
|
390
|
+
...hints
|
|
391
|
+
].join("\n");
|
|
392
|
+
}
|
|
393
|
+
function renderFlatResourceListViewport(resources, opts) {
|
|
394
|
+
if (resources.length === 0) {
|
|
395
|
+
return "No resources found.";
|
|
396
|
+
}
|
|
397
|
+
const maxVisibleRows = computeMaxVisibleTableRows(
|
|
398
|
+
opts.terminalRows,
|
|
399
|
+
VIEWPORT_CHROME_LINES.resourceList
|
|
400
|
+
);
|
|
401
|
+
const activeIndex = clampIndex(opts.activeIndex, resources.length);
|
|
402
|
+
const viewport = resolveSectionViewport(resources.length, activeIndex, maxVisibleRows);
|
|
403
|
+
const visibleRows = resources.slice(viewport.start, viewport.end);
|
|
404
|
+
const hasNamespace = hasListNamespace(visibleRows);
|
|
405
|
+
const columns = makeResourceListColumns(opts.showId, false, hasNamespace, true);
|
|
406
|
+
const selectedId = resources[activeIndex]?.id;
|
|
407
|
+
const hints = [];
|
|
408
|
+
if (viewport.start > 0) {
|
|
409
|
+
hints.push(theme.muted(` \u2191 ${viewport.start} above`));
|
|
410
|
+
}
|
|
411
|
+
if (viewport.end < resources.length) {
|
|
412
|
+
hints.push(theme.muted(` \u2193 ${resources.length - viewport.end} more`));
|
|
413
|
+
}
|
|
414
|
+
return [
|
|
415
|
+
renderTable({
|
|
416
|
+
columns,
|
|
417
|
+
rows: decorateRowsForSelection(visibleRows, selectedId),
|
|
418
|
+
summary: `${resources.length} resources`,
|
|
419
|
+
...resourceListTableLayout(opts)
|
|
420
|
+
}),
|
|
421
|
+
...hints
|
|
422
|
+
].join("\n");
|
|
423
|
+
}
|
|
424
|
+
function resourceListTableLayout(opts) {
|
|
425
|
+
return {
|
|
426
|
+
maxWidth: resolveTableMaxWidth(opts.maxWidth),
|
|
427
|
+
wordWrap: true
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
function makeIdColumn(showId, width = 13) {
|
|
431
|
+
return showId ? [{
|
|
432
|
+
key: "id",
|
|
433
|
+
header: "ID",
|
|
434
|
+
width,
|
|
435
|
+
minWidth: width,
|
|
436
|
+
widthShare: 0.18,
|
|
437
|
+
wrapOnWordBoundary: false,
|
|
438
|
+
transform: (value) => shortenId(String(value))
|
|
439
|
+
}] : [];
|
|
440
|
+
}
|
|
441
|
+
function makeResourceTypeColumn(width = 14) {
|
|
442
|
+
return {
|
|
443
|
+
key: "type",
|
|
444
|
+
header: "TYPE",
|
|
445
|
+
width,
|
|
446
|
+
style: (value) => theme.resourceType(value)
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
function makeResourceListColumns(showId, showType, hasNamespace, highlightSelection) {
|
|
450
|
+
return [
|
|
451
|
+
...makeIdColumn(showId),
|
|
452
|
+
...showType ? [makeResourceTypeColumn()] : [],
|
|
453
|
+
{
|
|
454
|
+
key: "list_display_name",
|
|
455
|
+
header: "NAME",
|
|
456
|
+
width: 28,
|
|
457
|
+
widthShare: 0.45,
|
|
458
|
+
wrapOnWordBoundary: false,
|
|
459
|
+
style: highlightSelection ? (value) => value.startsWith("> ") ? theme.accent(value) : value : void 0
|
|
460
|
+
},
|
|
461
|
+
...hasNamespace ? [{
|
|
462
|
+
key: "list_namespace",
|
|
463
|
+
header: "NAMESPACE",
|
|
464
|
+
width: 20,
|
|
465
|
+
widthShare: 0.3,
|
|
466
|
+
style: (value) => value ? theme.path(value) : theme.muted(": ")
|
|
467
|
+
}] : [],
|
|
468
|
+
{
|
|
469
|
+
key: "updated_at",
|
|
470
|
+
header: "UPDATED",
|
|
471
|
+
width: 16,
|
|
472
|
+
fitContent: true,
|
|
473
|
+
transform: (value) => formatRelativeTime(String(value)),
|
|
474
|
+
style: (value) => theme.muted(value)
|
|
475
|
+
}
|
|
476
|
+
];
|
|
477
|
+
}
|
|
478
|
+
function toResourceListRows(resources) {
|
|
479
|
+
const collidingNames = duplicatePluginNames(resources);
|
|
480
|
+
return resources.map((resource) => ({
|
|
481
|
+
...resource,
|
|
482
|
+
namespace: resource.namespace ?? "",
|
|
483
|
+
display_name: formatResourceDisplayName(resource, {
|
|
484
|
+
disambiguatePlugin: collidingNames.has(resource.name)
|
|
485
|
+
})
|
|
486
|
+
}));
|
|
487
|
+
}
|
|
488
|
+
function sortResourcesByUpdatedAt(resources) {
|
|
489
|
+
return [...resources].sort(
|
|
490
|
+
(left, right) => Date.parse(right.updated_at) - Date.parse(left.updated_at)
|
|
491
|
+
);
|
|
492
|
+
}
|
|
493
|
+
function filterResourcesBySearch(resources, search) {
|
|
494
|
+
const parsed = parseListSearchQuery(search);
|
|
495
|
+
if (parsed.raw.length === 0) {
|
|
496
|
+
return resources;
|
|
497
|
+
}
|
|
498
|
+
const sectionIsResourceType = parsed.section !== void 0 && RESOURCE_TYPES.includes(parsed.section);
|
|
499
|
+
const textQuery = sectionIsResourceType ? parsed : parsed.section !== void 0 ? { section: void 0, text: parsed.raw, raw: parsed.raw } : parsed;
|
|
500
|
+
return resources.filter((resource) => {
|
|
501
|
+
if (sectionIsResourceType && resource.type !== parsed.section) {
|
|
502
|
+
return false;
|
|
503
|
+
}
|
|
504
|
+
const haystack = `${resource.name} ${resource.description ?? ""} ${resource.display_name} ${formatResourceListNamespace(resource)}`;
|
|
505
|
+
return matchesListSearchQuery(haystack, textQuery);
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
function filterPluginEditRowsBySearch(rows, search) {
|
|
509
|
+
const normalizedSearch = search.trim().toLowerCase();
|
|
510
|
+
if (normalizedSearch.length === 0) {
|
|
511
|
+
return rows;
|
|
512
|
+
}
|
|
513
|
+
return rows.filter(
|
|
514
|
+
(row) => `${row.name} ${row.description ?? ""} ${row.display_name} ${row.version_constraint ?? ""}`.toLowerCase().includes(normalizedSearch)
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
function sortPluginEditRowsForDisplay(rows) {
|
|
518
|
+
return [...rows].sort((left, right) => {
|
|
519
|
+
if (left.checked !== right.checked) {
|
|
520
|
+
return left.checked ? -1 : 1;
|
|
521
|
+
}
|
|
522
|
+
return Date.parse(right.updated_at) - Date.parse(left.updated_at);
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
function renderResourceTypeSubheader(type, count) {
|
|
526
|
+
return `${theme.resourceType(type)} ${theme.muted(`(${count})`)}`;
|
|
527
|
+
}
|
|
528
|
+
function resolvePerTypeLimit(opts) {
|
|
529
|
+
if (opts.showAll) {
|
|
530
|
+
return void 0;
|
|
531
|
+
}
|
|
532
|
+
return opts.perTypeLimit ?? DEFAULT_RESOURCE_LIST_PER_TYPE_LIMIT;
|
|
533
|
+
}
|
|
534
|
+
function limitRows(rows, limit, selectedResourceId) {
|
|
535
|
+
if (limit === void 0 || rows.length <= limit) {
|
|
536
|
+
return { visible: rows, hiddenCount: 0 };
|
|
537
|
+
}
|
|
538
|
+
let visible = rows.slice(0, limit);
|
|
539
|
+
if (selectedResourceId && !visible.some((row) => row.id === selectedResourceId)) {
|
|
540
|
+
const selected = rows.find((row) => row.id === selectedResourceId);
|
|
541
|
+
if (selected) {
|
|
542
|
+
visible = [...visible.slice(0, Math.max(0, limit - 1)), selected];
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
const hiddenCount = rows.length - visible.length;
|
|
546
|
+
return { visible, hiddenCount };
|
|
547
|
+
}
|
|
548
|
+
function listNavigableResources(resources, typeFilter) {
|
|
549
|
+
if (typeFilter) {
|
|
550
|
+
return sortResourcesByUpdatedAt(
|
|
551
|
+
resources.filter((resource) => resource.type === typeFilter)
|
|
552
|
+
);
|
|
553
|
+
}
|
|
554
|
+
const ordered = [];
|
|
555
|
+
for (const type of RESOURCE_TYPES) {
|
|
556
|
+
ordered.push(
|
|
557
|
+
...sortResourcesByUpdatedAt(
|
|
558
|
+
resources.filter((resource) => resource.type === type)
|
|
559
|
+
)
|
|
560
|
+
);
|
|
561
|
+
}
|
|
562
|
+
return ordered;
|
|
563
|
+
}
|
|
564
|
+
function decorateRowsForCheckboxes(rows, opts) {
|
|
565
|
+
return rows.map((row) => {
|
|
566
|
+
const checkbox = row.checked ? "[x]" : "[ ]";
|
|
567
|
+
const cursor = row.id === opts.activeRowId ? ">" : " ";
|
|
568
|
+
const constraint = row.checked && row.version_constraint ? ` (${row.version_constraint})` : "";
|
|
569
|
+
return {
|
|
570
|
+
...row,
|
|
571
|
+
list_display_name: `${cursor}${checkbox} ${resourceHumanName(row)}${constraint}`,
|
|
572
|
+
list_namespace: formatResourceListNamespace(row)
|
|
573
|
+
};
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
function listNavigablePluginEditRows(rows, typeFilter) {
|
|
577
|
+
if (typeFilter) {
|
|
578
|
+
return sortPluginEditRowsForDisplay(
|
|
579
|
+
rows.filter((row) => row.type === typeFilter)
|
|
580
|
+
);
|
|
581
|
+
}
|
|
582
|
+
const ordered = [];
|
|
583
|
+
for (const type of RESOURCE_TYPES) {
|
|
584
|
+
ordered.push(
|
|
585
|
+
...sortPluginEditRowsForDisplay(
|
|
586
|
+
rows.filter((row) => row.type === type)
|
|
587
|
+
)
|
|
588
|
+
);
|
|
589
|
+
}
|
|
590
|
+
return ordered;
|
|
591
|
+
}
|
|
592
|
+
function decorateRowsForSelection(rows, selectedResourceId) {
|
|
593
|
+
return rows.map((row) => ({
|
|
594
|
+
...row,
|
|
595
|
+
list_display_name: row.id === selectedResourceId ? `> ${resourceHumanName(row)}` : ` ${resourceHumanName(row)}`,
|
|
596
|
+
list_namespace: formatResourceListNamespace(row)
|
|
597
|
+
}));
|
|
598
|
+
}
|
|
599
|
+
function formatResourceSelectionLabel(resource) {
|
|
600
|
+
return `${resource.type} ${resourceHumanName(resource)}`;
|
|
601
|
+
}
|
|
602
|
+
function renderHiddenRowsHint(hiddenCount) {
|
|
603
|
+
return theme.muted(
|
|
604
|
+
` ... and ${hiddenCount} more ${hiddenCount === 1 ? "resource" : "resources"} (use --all to show all)`
|
|
605
|
+
);
|
|
606
|
+
}
|
|
607
|
+
function renderGroupedResourceListTables(resources, opts) {
|
|
608
|
+
if (resources.length === 0) {
|
|
609
|
+
return "No resources found.";
|
|
610
|
+
}
|
|
611
|
+
const hasNamespace = hasListNamespace(resources);
|
|
612
|
+
const highlightSelection = Boolean(opts.selectedResourceId);
|
|
613
|
+
const columns = makeResourceListColumns(opts.showId, false, hasNamespace, highlightSelection);
|
|
614
|
+
const perTypeLimit = resolvePerTypeLimit(opts);
|
|
615
|
+
const lines = [];
|
|
616
|
+
let wroteSection = false;
|
|
617
|
+
for (const type of RESOURCE_TYPES) {
|
|
618
|
+
const rows = sortResourcesByUpdatedAt(
|
|
619
|
+
resources.filter((resource) => resource.type === type)
|
|
620
|
+
);
|
|
621
|
+
if (rows.length === 0) {
|
|
622
|
+
continue;
|
|
623
|
+
}
|
|
624
|
+
const { visible, hiddenCount } = limitRows(
|
|
625
|
+
rows,
|
|
626
|
+
perTypeLimit,
|
|
627
|
+
opts.selectedResourceId
|
|
628
|
+
);
|
|
629
|
+
if (wroteSection) {
|
|
630
|
+
lines.push("");
|
|
631
|
+
}
|
|
632
|
+
wroteSection = true;
|
|
633
|
+
lines.push(renderResourceTypeSubheader(type, rows.length));
|
|
634
|
+
lines.push(renderTable({
|
|
635
|
+
columns,
|
|
636
|
+
rows: decorateRowsForSelection(visible, opts.selectedResourceId),
|
|
637
|
+
...resourceListTableLayout(opts)
|
|
638
|
+
}));
|
|
639
|
+
if (hiddenCount > 0) {
|
|
640
|
+
lines.push(renderHiddenRowsHint(hiddenCount));
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
lines.push("");
|
|
644
|
+
lines.push(theme.info(`${resources.length} resources`));
|
|
645
|
+
return lines.join("\n");
|
|
646
|
+
}
|
|
647
|
+
function renderFlatResourceListTable(resources, opts) {
|
|
648
|
+
if (resources.length === 0) {
|
|
649
|
+
return "No resources found.";
|
|
650
|
+
}
|
|
651
|
+
const hasNamespace = hasListNamespace(resources);
|
|
652
|
+
const sortedRows = sortResourcesByUpdatedAt(resources);
|
|
653
|
+
const perTypeLimit = resolvePerTypeLimit(opts);
|
|
654
|
+
const highlightSelection = Boolean(opts.selectedResourceId);
|
|
655
|
+
const { visible, hiddenCount } = limitRows(
|
|
656
|
+
sortedRows,
|
|
657
|
+
perTypeLimit,
|
|
658
|
+
opts.selectedResourceId
|
|
659
|
+
);
|
|
660
|
+
const lines = [
|
|
661
|
+
renderTable({
|
|
662
|
+
columns: makeResourceListColumns(opts.showId, false, hasNamespace, highlightSelection),
|
|
663
|
+
rows: decorateRowsForSelection(visible, opts.selectedResourceId),
|
|
664
|
+
summary: `${sortedRows.length} resources`,
|
|
665
|
+
...resourceListTableLayout(opts)
|
|
666
|
+
})
|
|
667
|
+
];
|
|
668
|
+
if (hiddenCount > 0) {
|
|
669
|
+
lines.push(renderHiddenRowsHint(hiddenCount));
|
|
670
|
+
}
|
|
671
|
+
return lines.join("\n");
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
export {
|
|
675
|
+
formatOriginDisplayLabel,
|
|
676
|
+
resourceHumanName,
|
|
677
|
+
formatResourceDisplayName,
|
|
678
|
+
isPackageEntryFileName,
|
|
679
|
+
packageDirectoryDisplayPath,
|
|
680
|
+
inferContainedFileType,
|
|
681
|
+
containedFileStem,
|
|
682
|
+
renderGroupedResourceListViewport,
|
|
683
|
+
renderGroupedPluginEditViewport,
|
|
684
|
+
renderFlatPluginEditViewport,
|
|
685
|
+
renderFlatResourceListViewport,
|
|
686
|
+
toResourceListRows,
|
|
687
|
+
sortResourcesByUpdatedAt,
|
|
688
|
+
filterResourcesBySearch,
|
|
689
|
+
filterPluginEditRowsBySearch,
|
|
690
|
+
listNavigableResources,
|
|
691
|
+
listNavigablePluginEditRows,
|
|
692
|
+
formatResourceSelectionLabel,
|
|
693
|
+
renderGroupedResourceListTables,
|
|
694
|
+
renderFlatResourceListTable
|
|
695
|
+
};
|
|
696
|
+
//# sourceMappingURL=chunk-T5VRREN4.js.map
|