@nodii/dev 0.6.73 → 0.6.75

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/setup.js CHANGED
@@ -3,7 +3,7 @@ import { dirname, join, resolve } from "node:path";
3
3
  import { CliError, checkLogin } from "./core.js";
4
4
  import { codexHooksFromClaude } from "./harness.js";
5
5
  import { regroundingHooksSnippet, safetySettingsSnippet } from "./safety.js";
6
- import { EMBED_MODEL, PICKER_MODEL, setupOllama } from "./gather.js";
6
+ import { EMBED_MODEL, pickerPin, setupOllama } from "./gather.js";
7
7
 
8
8
  export const SKILL_PATH = ".claude/skills/nodii-build-workflow/SKILL.md";
9
9
  const START = "<!-- nodii-dev build workflow:start -->";
@@ -119,21 +119,23 @@ export async function setupPlan(root = process.cwd()) {
119
119
  return changes;
120
120
  }
121
121
 
122
- export async function setupCommand(flags, { root = process.cwd(), authCheck = checkLogin, pickerSetup = setupOllama } = {}) {
122
+ export async function setupCommand(flags, { root = process.cwd(), authCheck = checkLogin, pickerSetup = setupOllama, env = process.env } = {}) {
123
123
  if (flags.yes && flags.check) throw new CliError("USAGE", "setup accepts either --yes or --check, not both.", 2);
124
124
  const changes = await setupPlan(root);
125
125
  let authenticated = true;
126
126
  try { await authCheck(); } catch { authenticated = false; }
127
+ // A model name this CLI does not pin is a usage error, not a picker gap.
128
+ const pickerModel = pickerPin(env).name;
127
129
  let pickerReady = true;
128
130
  let pickerStatus;
129
- try { pickerStatus = await pickerSetup({ check: !flags.yes }); }
131
+ try { pickerStatus = await pickerSetup({ check: !flags.yes, env }); }
130
132
  catch (error) {
131
133
  pickerReady = false;
132
134
  pickerStatus = { code: error?.code ?? "PICKER_UNAVAILABLE", message: error?.message ?? String(error) };
133
135
  }
134
136
  // Only the section embedding pin is missing: the picker itself is ready.
135
137
  const embedOnly = !pickerReady && String(pickerStatus.code).startsWith("EMBED_");
136
- const missingModels = embedOnly ? [EMBED_MODEL] : [PICKER_MODEL, EMBED_MODEL];
138
+ const missingModels = embedOnly ? [EMBED_MODEL] : [pickerModel, EMBED_MODEL];
137
139
  if (flags.check) {
138
140
  const drift = [
139
141
  ...(changes.length ? [`Workflow harness drift: ${changes.map((x) => x.relative).join(", ")}`] : []),
@@ -145,7 +147,7 @@ export async function setupCommand(flags, { root = process.cwd(), authCheck = ch
145
147
  if (!flags.yes) {
146
148
  const preview = [
147
149
  ...(changes.length ? changes.map((x) => `${x.before === null ? "+ create" : "~ update"} ${x.relative}`) : ["No workflow changes."]),
148
- pickerReady ? `Gather picker: ${PICKER_MODEL} and ${EMBED_MODEL} are ready.` : `+ ${embedOnly ? "" : "install Ollama and "}pull ${missingModels.join(" and ")}`,
150
+ pickerReady ? `Gather picker: ${pickerModel} and ${EMBED_MODEL} are ready.` : `+ ${embedOnly ? "" : "install Ollama and "}pull ${missingModels.join(" and ")}`,
149
151
  ].join("\n");
150
152
  return { payload: { dryRun: true, changed: [...changes.map((x) => x.relative), ...(!pickerReady ? missingModels.map((m) => `ollama:${m}`) : [])], authenticated, picker: pickerStatus }, human: `${preview}\n${authenticated ? "Authentication: ready." : "Authentication: not logged in; run `nodii-dev login`."}\nRun \`nodii-dev setup --yes\` to apply.` };
151
153
  }
@@ -154,5 +156,5 @@ export async function setupCommand(flags, { root = process.cwd(), authCheck = ch
154
156
  await mkdir(dirname(change.path), { recursive: true });
155
157
  await writeFile(change.path, change.content);
156
158
  }
157
- return { payload: { applied: true, changed: [...changes.map((x) => x.relative), ...(pickerStatus.changed ?? []).map((x) => `ollama:${x}`)], authenticated, picker: pickerStatus }, human: `${changes.length ? `Applied: ${changes.map((x) => x.relative).join(", ")}` : "Workflow harness already current."}\nGather picker: ${PICKER_MODEL} and ${EMBED_MODEL} ready on Ollama ${pickerStatus.version}.\n${authenticated ? "Authentication: ready." : "Not logged in; run `nodii-dev login`."}` };
159
+ return { payload: { applied: true, changed: [...changes.map((x) => x.relative), ...(pickerStatus.changed ?? []).map((x) => `ollama:${x}`)], authenticated, picker: pickerStatus }, human: `${changes.length ? `Applied: ${changes.map((x) => x.relative).join(", ")}` : "Workflow harness already current."}\nGather picker: ${pickerModel} and ${EMBED_MODEL} ready on Ollama ${pickerStatus.version}.\n${authenticated ? "Authentication: ready." : "Not logged in; run `nodii-dev login`."}` };
158
160
  }