@z0ne/installer 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/main.js +49 -15
- package/package.json +1 -1
package/lib/main.js
CHANGED
|
@@ -124,6 +124,40 @@ async function install(flags) {
|
|
|
124
124
|
const rowsById = Object.fromEntries(rows.map((r) => [r.id, r]));
|
|
125
125
|
const defs = api.defaultModels(ids);
|
|
126
126
|
const modelItems = ids.map((id) => ({ value: id, label: id, hint: hintOf(rowsById[id]) }));
|
|
127
|
+
const vendorOf = (id) => (rowsById[id] && rowsById[id].vendor) || "";
|
|
128
|
+
const SHOW_ALL = "__show_all__";
|
|
129
|
+
const showAllItem = { value: SHOW_ALL, label: "-> show all " + ids.length + " models", hint: "full catalog" };
|
|
130
|
+
|
|
131
|
+
// Novice-friendly picker: a curated shortlist (preferred ids first, then
|
|
132
|
+
// one model per remaining vendor, max 11 so the "show all" row still fits
|
|
133
|
+
// the 12-row picker window without scrolling). Non-TTY runs never see it.
|
|
134
|
+
const shortlistItems = (preferredIds) => {
|
|
135
|
+
const seen = new Set();
|
|
136
|
+
const items = [];
|
|
137
|
+
for (const id of preferredIds) {
|
|
138
|
+
if (ids.includes(id) && !seen.has(id)) {
|
|
139
|
+
seen.add(id);
|
|
140
|
+
items.push({ value: id, label: id, hint: hintOf(rowsById[id]) });
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
const vendorTaken = new Set(items.map((it) => vendorOf(it.value)));
|
|
144
|
+
for (const id of ids) {
|
|
145
|
+
if (items.length >= 11) break;
|
|
146
|
+
const v = vendorOf(id);
|
|
147
|
+
if (seen.has(id) || vendorTaken.has(v)) continue;
|
|
148
|
+
seen.add(id);
|
|
149
|
+
vendorTaken.add(v);
|
|
150
|
+
items.push({ value: id, label: id, hint: hintOf(rowsById[id]) });
|
|
151
|
+
}
|
|
152
|
+
return items;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const pickModel = async (title, shortItems, def) => {
|
|
156
|
+
if (!shortItems.length) return ui.selectOne(title, modelItems, def);
|
|
157
|
+
const first = await ui.selectOne(title, shortItems.concat([showAllItem]), def);
|
|
158
|
+
if (first !== SHOW_ALL) return first;
|
|
159
|
+
return ui.selectOne(title, modelItems, def);
|
|
160
|
+
};
|
|
127
161
|
|
|
128
162
|
// 1. which tools
|
|
129
163
|
let toolIds;
|
|
@@ -153,28 +187,28 @@ async function install(flags) {
|
|
|
153
187
|
let model = typeof flags.model === "string" ? flags.model : defs.model;
|
|
154
188
|
if (openaiTools.length && typeof flags.model !== "string" && ui.isInteractive()) {
|
|
155
189
|
ui.log();
|
|
156
|
-
model = await
|
|
190
|
+
model = await pickModel(
|
|
191
|
+
"Default model for " + openaiTools.map((id) => byId(id).title).join(", "),
|
|
192
|
+
shortlistItems([defs.model, defs.sonnet, defs.opus]),
|
|
193
|
+
defs.model
|
|
194
|
+
);
|
|
157
195
|
}
|
|
158
196
|
if (model && !ids.includes(model)) {
|
|
159
197
|
ui.warn('model "' + model + '" is not in the live catalog - using it anyway');
|
|
160
198
|
}
|
|
161
199
|
|
|
162
|
-
// 3. Claude Code model slots
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
const
|
|
167
|
-
|
|
200
|
+
// 3. Claude Code model slots - never asked interactively: Claude Code has
|
|
201
|
+
// its own opus/sonnet/haiku slots and the recommended Claude models are
|
|
202
|
+
// the right answer for nearly everyone. Power users override via flags.
|
|
203
|
+
const opus = typeof flags.opus === "string" ? flags.opus : defs.opus;
|
|
204
|
+
const sonnet = typeof flags.sonnet === "string" ? flags.sonnet : defs.sonnet;
|
|
205
|
+
const haiku = typeof flags.haiku === "string" ? flags.haiku : defs.haiku;
|
|
206
|
+
if (toolIds.includes("claude") && ui.isInteractive()) {
|
|
168
207
|
ui.log();
|
|
169
|
-
|
|
170
|
-
"Claude Code
|
|
171
|
-
|
|
208
|
+
ui.info(
|
|
209
|
+
"Claude Code runs on Claude models automatically: " + opus + " / " + sonnet + " / " + haiku +
|
|
210
|
+
fmt.gray(" (override: --opus --sonnet --haiku)")
|
|
172
211
|
);
|
|
173
|
-
if (!keep) {
|
|
174
|
-
opus = await ui.selectOne("Opus-slot model", modelItems, opus);
|
|
175
|
-
sonnet = await ui.selectOne("Sonnet-slot model", modelItems, sonnet);
|
|
176
|
-
haiku = await ui.selectOne("Haiku-slot model", modelItems, haiku);
|
|
177
|
-
}
|
|
178
212
|
}
|
|
179
213
|
|
|
180
214
|
// 4. statusline (Claude Code only)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@z0ne/installer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Point coding agents at z0ne.ai — Claude Code, Codex, OpenCode, Cline, Hermes, OpenClaw. One key, one command. Optionally installs a Claude Code statusline.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://z0ne.ai",
|