@helix3/helix-cli 0.1.14-helix3.177 → 0.1.14-helix3.178
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +84 -0
- package/dist/index.js.map +1 -1
- package/dist/itemSearch.d.ts +128 -0
- package/dist/itemSearch.js +140 -0
- package/dist/itemSearch.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -41,6 +41,7 @@ const node_path_1 = require("node:path");
|
|
|
41
41
|
const node_os_1 = require("node:os");
|
|
42
42
|
const lib_1 = require("./lib");
|
|
43
43
|
const itemQuote_1 = require("./itemQuote");
|
|
44
|
+
const itemSearch_1 = require("./itemSearch");
|
|
44
45
|
const tables_1 = require("./itemDef/tables");
|
|
45
46
|
const emoteRules_1 = require("./itemDef/emoteRules");
|
|
46
47
|
const scaffold_1 = require("./itemDef/scaffold");
|
|
@@ -1114,6 +1115,89 @@ const item = program
|
|
|
1114
1115
|
// a dedicated command for a closed two-value list is a command to discover, to
|
|
1115
1116
|
// document and to keep in sync, for information that fits on one line under the
|
|
1116
1117
|
// list it is always read with. `--gender`'s own help carries the same values.
|
|
1118
|
+
item
|
|
1119
|
+
.command('search')
|
|
1120
|
+
.description('Search the published MARKETPLACE catalogue — including builds, the presets someone already assembled')
|
|
1121
|
+
.argument('[query]', 'free text over title, slug and tags')
|
|
1122
|
+
.option('--kind <kind>', 'universal item kind (avatar, wearable, vehicle, weapon, add_on, home_item, emote, prop)')
|
|
1123
|
+
.option('--category <category>', 'marketplace category')
|
|
1124
|
+
.option('--sub-category <subCategory>', 'form factor beneath the category, e.g. car / rifle / art')
|
|
1125
|
+
.option('--tag <tag>', 'exact tag')
|
|
1126
|
+
.option('--host-kind <hostKind>', 'host class, e.g. vehicle / character / weapon')
|
|
1127
|
+
.option('--builds <mode>', `builds in the results: ${itemSearch_1.BUILD_FILTER_MODES.join(' | ')} (default include — a build is filed under its base's own category, so it comes back alongside bases unless you narrow)`)
|
|
1128
|
+
.option('--limit <n>', 'rows to return (1-100, default 20)')
|
|
1129
|
+
.option('--json', 'machine-readable output')
|
|
1130
|
+
.action(async (query, opts) => {
|
|
1131
|
+
const creds = requireAuth();
|
|
1132
|
+
if (opts.builds && !itemSearch_1.BUILD_FILTER_MODES.includes(opts.builds)) {
|
|
1133
|
+
fail(`✖ --builds must be one of ${itemSearch_1.BUILD_FILTER_MODES.join(', ')}, got '${opts.builds}'`);
|
|
1134
|
+
}
|
|
1135
|
+
try {
|
|
1136
|
+
const result = await (0, itemSearch_1.searchItems)(lib_1.HelixApi.forCredentials(creds), {
|
|
1137
|
+
query,
|
|
1138
|
+
kind: opts.kind,
|
|
1139
|
+
category: opts.category,
|
|
1140
|
+
subCategory: opts.subCategory,
|
|
1141
|
+
tag: opts.tag,
|
|
1142
|
+
hostKind: opts.hostKind,
|
|
1143
|
+
builds: opts.builds,
|
|
1144
|
+
limit: opts.limit ? parsePositiveInt(opts.limit, '--limit') : undefined,
|
|
1145
|
+
});
|
|
1146
|
+
if (opts.json)
|
|
1147
|
+
return printJson(result);
|
|
1148
|
+
if (result.items.length === 0) {
|
|
1149
|
+
console.log('No published items match.');
|
|
1150
|
+
return;
|
|
1151
|
+
}
|
|
1152
|
+
for (const row of result.items) {
|
|
1153
|
+
// The BUILD mark leads the line. A build is filed under its base's
|
|
1154
|
+
// own kind, so without it these rows are indistinguishable from the
|
|
1155
|
+
// bases they were assembled from — which is the whole reason builds
|
|
1156
|
+
// do not get a category of their own.
|
|
1157
|
+
const mark = row.buildKind ? `[build:${row.buildKind}] ` : '';
|
|
1158
|
+
const price = row.priceLix === null ? 'unlisted' : `Ⱡ${row.priceLix}`;
|
|
1159
|
+
console.log(`${mark}${row.title} (${row.kind}, ${price})`);
|
|
1160
|
+
console.log(` ${row.id}${row.creator ? ` by ${row.creator}` : ''}`);
|
|
1161
|
+
}
|
|
1162
|
+
if (result.totalItems !== null && result.totalItems > result.items.length) {
|
|
1163
|
+
console.error(`\nShowing ${result.items.length} of ${result.totalItems}. Use --limit to widen.`);
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
catch (err) {
|
|
1167
|
+
fail(`✖ ${err instanceof Error ? err.message : String(err)}`);
|
|
1168
|
+
}
|
|
1169
|
+
});
|
|
1170
|
+
item
|
|
1171
|
+
.command('build')
|
|
1172
|
+
.description("What is in a published build: its base, its parts, what you own, and what the parts cost together")
|
|
1173
|
+
.argument('<itemId>', 'universal item id of the build')
|
|
1174
|
+
.option('--json', 'machine-readable output')
|
|
1175
|
+
.action(async (itemId, opts) => {
|
|
1176
|
+
const creds = requireAuth();
|
|
1177
|
+
try {
|
|
1178
|
+
const result = await (0, itemSearch_1.getItemBuild)(lib_1.HelixApi.forCredentials(creds), itemId);
|
|
1179
|
+
if (opts.json)
|
|
1180
|
+
return printJson(result);
|
|
1181
|
+
console.log(`Build (${result.kind}) — ${result.parts.length} part(s)`);
|
|
1182
|
+
for (const part of result.parts) {
|
|
1183
|
+
const name = part.title ?? 'Not listed on the marketplace yet';
|
|
1184
|
+
// `owned === null` means nobody is signed in. Printing that as "not
|
|
1185
|
+
// owned" would be a claim about the caller's inventory we cannot make.
|
|
1186
|
+
const owned = part.owned === true ? ' [owned]' : '';
|
|
1187
|
+
const price = part.priceLix === null ? '' : ` Ⱡ${part.priceLix}`;
|
|
1188
|
+
console.log(` ${part.slot.padEnd(16)} ${name}${price}${owned}`);
|
|
1189
|
+
}
|
|
1190
|
+
if (result.unresolvedPartCount > 0) {
|
|
1191
|
+
// Named, never silently dropped: the total below describes only the
|
|
1192
|
+
// listed parts, and a reader must not mistake it for the whole build.
|
|
1193
|
+
console.log(`\n${result.unresolvedPartCount} part(s) are not listed yet and are NOT in the total.`);
|
|
1194
|
+
}
|
|
1195
|
+
console.log(`\nBuild total (sum of the listed parts): Ⱡ${result.totalPriceLix}`);
|
|
1196
|
+
}
|
|
1197
|
+
catch (err) {
|
|
1198
|
+
fail(`✖ ${err instanceof Error ? err.message : String(err)}`);
|
|
1199
|
+
}
|
|
1200
|
+
});
|
|
1117
1201
|
item
|
|
1118
1202
|
.command('list-slots')
|
|
1119
1203
|
.description('Print the Character-Creator vocabulary a wearable declares: the cosmetic slot tags, and the genders')
|