@nodii/dev 0.6.72 → 0.6.74
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 +150 -7
- package/dist/cli.js +84 -16
- package/dist/core.js +2 -2
- package/dist/design.js +46 -2
- package/dist/doctor.js +17 -7
- package/dist/figma.js +44 -0
- package/dist/flags.js +5 -1
- package/dist/freeze.js +12 -0
- package/dist/gather.js +51 -23
- package/dist/harness.js +8 -4
- package/dist/hooks.js +1 -25
- package/dist/lanes.js +74 -23
- package/dist/managed-hooks.js +60 -9
- package/dist/nudges.js +166 -2
- package/dist/receipt.js +365 -0
- package/dist/review.js +76 -4
- package/dist/safety.js +8 -1
- package/dist/session-kind.js +243 -0
- package/dist/setup.js +8 -6
- package/dist/surface.js +847 -0
- package/dist/vendor/render-templates.mjs +740 -0
- package/package.json +1 -1
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
// Session kind (DEC-0421, MW1-92 to MW1-95).
|
|
2
|
+
//
|
|
3
|
+
// Every session is a lane, a coordinator, a steward or an operator assistant.
|
|
4
|
+
// SessionStart infers the kind from Dev (a lane record for the worktree, a
|
|
5
|
+
// steward registration for this agent, the machine's coordinator role) and
|
|
6
|
+
// the first prompt confirms or corrects it from the prompt's own words. Both
|
|
7
|
+
// print the kind with its contract. A steward is a lane of kind `steward`
|
|
8
|
+
// with no branch or worktree, so it reuses lane Gather, Freeze and the
|
|
9
|
+
// post-compaction re-grounding. Every entry point fails open: no Dev, no
|
|
10
|
+
// sign-in or an unknown payload ends in the operator-assistant reading.
|
|
11
|
+
import { mkdir, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
12
|
+
import { basename, dirname, join } from "node:path";
|
|
13
|
+
import { CliError, configPath, devRequest, encode, query, readConfig, requireFlag } from "./core.js";
|
|
14
|
+
import { currentLane, regroundLane } from "./freeze.js";
|
|
15
|
+
import { gatherText } from "./gather.js";
|
|
16
|
+
|
|
17
|
+
export const SESSION_KINDS = ["lane", "coordinator", "steward", "operator_assistant"];
|
|
18
|
+
const KIND_LABEL = { lane: "lane", coordinator: "coordinator", steward: "steward", operator_assistant: "operator assistant" };
|
|
19
|
+
const LIVE = new Set(["queued", "building", "built", "review", "on_main"]);
|
|
20
|
+
/** A steward's Gather objective: its role and the operator's current focus (MW1-94). */
|
|
21
|
+
export const stewardObjective = (focus) => `Steward role (MW1-93) for the operator's current focus: ${focus}`;
|
|
22
|
+
export const STEWARD_DONE_CHECK = "A steward is never done: it stewards the operator's focus until a staff person stops it (MW1-93).";
|
|
23
|
+
const STATE_DIR = "session-kinds";
|
|
24
|
+
const STATE_TTL_MS = 7 * 24 * 60 * 60 * 1000;
|
|
25
|
+
|
|
26
|
+
export const isLaneConfig = (env = process.env) => /^lane-[a-z0-9_-]+\.json$/i.test(basename(env.NODII_DEV_CONFIG_PATH ?? ""));
|
|
27
|
+
|
|
28
|
+
/** This agent's live steward lane, or null. */
|
|
29
|
+
export async function activeSteward(agentId, { request = devRequest } = {}) {
|
|
30
|
+
if (!agentId) return null;
|
|
31
|
+
const page = await request("GET", `/api/v1/lanes${query({ agent: agentId, kind: "steward", limit: 20 })}`);
|
|
32
|
+
return (page.data ?? []).find((lane) => lane.kind === "steward" && LIVE.has(lane.status)) ?? null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** What Dev records about this session. */
|
|
36
|
+
export async function kindFromDev({ cwd = process.cwd(), env = process.env } = {}, { request = devRequest, config = readConfig } = {}) {
|
|
37
|
+
let current = null;
|
|
38
|
+
try { current = await config(false); } catch {}
|
|
39
|
+
const lane = current?.agentId ? await currentLane({ cwd }, { request, config }).catch(() => null) : null;
|
|
40
|
+
if (lane) return { kind: "lane", lane, source: `Dev lane ${lane.key} for this worktree` };
|
|
41
|
+
if (isLaneConfig(env)) return { kind: "lane", lane: null, source: `the lane config ${basename(env.NODII_DEV_CONFIG_PATH)}` };
|
|
42
|
+
if (!current?.agentId) return { kind: "operator_assistant", source: "no Dev sign-in in this session" };
|
|
43
|
+
const steward = await activeSteward(current.agentId, { request }).catch(() => null);
|
|
44
|
+
if (steward) return { kind: "steward", steward, source: `Dev steward registration ${steward.key} for this agent` };
|
|
45
|
+
const agent = (await request("GET", `/api/v1/agents/${encode(current.agentId)}`).catch(() => null))?.data;
|
|
46
|
+
if (agent?.role === "coordinator") return { kind: "coordinator", source: "this agent is its machine's coordinator in Dev" };
|
|
47
|
+
return { kind: "operator_assistant", source: "Dev has no lane, steward or coordinator record for this session" };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** What the first prompt says the session is, or null when it does not say. */
|
|
51
|
+
export function kindFromPrompt(prompt) {
|
|
52
|
+
const text = String(prompt ?? "");
|
|
53
|
+
const lane = /\byou are (?:the )?lane\s+[`'"]?([A-Za-z][\w-]*)/i.exec(text);
|
|
54
|
+
if (lane) return { kind: "lane", key: lane[1] };
|
|
55
|
+
if (/\byou are (?:now |the |a )?steward\b|\b(?:act|work) as (?:the |a )?steward\b|\bsteward session\b/i.test(text)) return { kind: "steward" };
|
|
56
|
+
if (/\byou are (?:now |the |a |this machine's )?coordinator\b|\bnodii-dev coordinator start\b/i.test(text)) return { kind: "coordinator" };
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Dev's record decides; the prompt fills in only where Dev has none, and a
|
|
62
|
+
* disagreement is said out loud so it is fixed in Dev, not acted on.
|
|
63
|
+
*/
|
|
64
|
+
export function resolveKind(dev, prompt) {
|
|
65
|
+
if (!prompt) return { ...dev, notes: [] };
|
|
66
|
+
if (prompt.kind === dev.kind) {
|
|
67
|
+
const other = prompt.kind === "lane" && prompt.key && dev.lane?.key && prompt.key !== dev.lane.key;
|
|
68
|
+
return { ...dev, source: `${dev.source}; the prompt agrees`, notes: other ? [`The prompt names lane ${prompt.key}, but this worktree is Dev lane ${dev.lane.key}. Work ${dev.lane.key}, or open ${prompt.key}'s own worktree.`] : [] };
|
|
69
|
+
}
|
|
70
|
+
if (dev.kind !== "operator_assistant")
|
|
71
|
+
return { ...dev, notes: [`The prompt reads as a ${KIND_LABEL[prompt.kind]} session, but Dev records a ${KIND_LABEL[dev.kind]} (${dev.source}). Act as the ${KIND_LABEL[dev.kind]}; if the prompt is right, fix the record in Dev first.`] };
|
|
72
|
+
const fix = {
|
|
73
|
+
steward: "Register it first: `nodii-dev steward register --focus \"<the operator's focus>\" --repos <repo,...>`, then `nodii-dev lane gather <key> --picker agent` (MW1-93, MW1-94).",
|
|
74
|
+
lane: `Dev has no lane ${prompt.key} for this worktree and agent: check \`nodii-dev lane show ${prompt.key}\` and open the lane's own worktree before working.`,
|
|
75
|
+
coordinator: "Dev does not record this agent as a machine's coordinator: `nodii-dev coordinator start --machine NAME` registers it.",
|
|
76
|
+
}[prompt.kind];
|
|
77
|
+
return { kind: prompt.kind, ...(prompt.key ? { promptKey: prompt.key } : {}), source: "the prompt (Dev has no record of it yet)", notes: [fix] };
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// A steward's title is the operator's focus itself (S01-46: a name holds no
|
|
81
|
+
// value that has its own field, and the kind is a field).
|
|
82
|
+
const focusOf = (steward) => String(steward?.title ?? "");
|
|
83
|
+
|
|
84
|
+
/** The clauses each kind's contract rests on, printed as Dev serves them (P-19). */
|
|
85
|
+
export const KIND_CLAUSES = {
|
|
86
|
+
lane: ["MW1-92"],
|
|
87
|
+
steward: ["MW1-92", "MW1-93", "MW1-94", "MW1-95"],
|
|
88
|
+
coordinator: ["MW1-92", "K01-22", "MW1-49.1"],
|
|
89
|
+
operator_assistant: ["MW1-92"],
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
async function clauseLines(ids, request) {
|
|
93
|
+
return Promise.all(ids.map(async (id) => {
|
|
94
|
+
try {
|
|
95
|
+
const [clause] = (await request("GET", `/api/v1/rules/clauses/${encode(id)}`)).data ?? [];
|
|
96
|
+
if (clause?.text) return `- ${id}: ${String(clause.text).replace(/\s+/g, " ").trim()}`;
|
|
97
|
+
} catch {}
|
|
98
|
+
return `- ${id}: Dev did not serve its text; read \`nodii-dev rules show ${id}\`.`;
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** The kind's contract: the clauses it rests on, from Dev, then the session's next commands. */
|
|
103
|
+
export async function kindContract(resolved, { request = devRequest } = {}) {
|
|
104
|
+
const { kind } = resolved;
|
|
105
|
+
const next = {
|
|
106
|
+
lane: () => {
|
|
107
|
+
const key = resolved.lane?.key ?? resolved.promptKey ?? "<key>";
|
|
108
|
+
return [`Next: the Lane contract of ${key} is the work. \`nodii-dev lane gather ${key}\` if it has not gathered, then the Task; when the done check is met, \`nodii-dev lane done-check ${key}\` and \`nodii-dev lane land ${key}\`.`];
|
|
109
|
+
},
|
|
110
|
+
steward: () => {
|
|
111
|
+
const key = resolved.steward?.key ?? "<key>";
|
|
112
|
+
return [
|
|
113
|
+
...(resolved.steward ? [`Focus: ${focusOf(resolved.steward)}`] : []),
|
|
114
|
+
`Next: \`nodii-dev lane gather ${key} --picker agent\`; steer only through the coordinator or \`nodii-dev lane amend <lane>\`, naming the clause or DEC id each time.`,
|
|
115
|
+
];
|
|
116
|
+
},
|
|
117
|
+
coordinator: () => ["Next: `nodii-dev lane list` for this machine's lanes."],
|
|
118
|
+
operator_assistant: () => [],
|
|
119
|
+
}[kind]();
|
|
120
|
+
return ["Contract (from Dev's rulebook):", ...(await clauseLines(KIND_CLAUSES[kind], request)), ...next];
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export async function kindText(resolved, { request = devRequest } = {}) {
|
|
124
|
+
return [
|
|
125
|
+
`Session kind: ${KIND_LABEL[resolved.kind]} (MW1-92) · from ${resolved.source}`,
|
|
126
|
+
`kind: ${resolved.kind}`,
|
|
127
|
+
...(await kindContract(resolved, { request })),
|
|
128
|
+
...(resolved.notes ?? []).map((note) => `Note: ${note}`),
|
|
129
|
+
].join("\n");
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** The steward's stored Clause map, or how to make one (MW1-94). */
|
|
133
|
+
async function stewardClauseMap(steward, request) {
|
|
134
|
+
try {
|
|
135
|
+
const payload = await request("GET", `/api/v1/lanes/${encode(steward.key)}/gather`);
|
|
136
|
+
return `Clause map ${steward.key} (Gather ${payload.data.gatherId}). Gather again now with the operator's current focus: \`nodii-dev lane gather ${steward.key} --delta --picker agent\` (MW1-94).\n${gatherText(payload, payload.data.objective ?? "")}`;
|
|
137
|
+
} catch {
|
|
138
|
+
return `Clause map: ${steward.key} has no Gather yet. Run \`nodii-dev lane gather ${steward.key} --picker agent\` before anything else (MW1-94).`;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** Plain text for SessionStart: the kind, its contract and, where it has one, its stored contract. */
|
|
143
|
+
export async function sessionStartText(payload, { request = devRequest, config = readConfig, env = process.env, dev = kindFromDev, state = writeKindState } = {}) {
|
|
144
|
+
const cwd = payload?.cwd ?? process.cwd();
|
|
145
|
+
const compact = payload?.source === "compact";
|
|
146
|
+
const resolved = { ...(await dev({ cwd, env }, { request, config })), notes: [] };
|
|
147
|
+
await state(payload?.session_id, { kind: resolved.kind, source: resolved.source }).catch(() => {});
|
|
148
|
+
const parts = [await kindText(resolved, { request })];
|
|
149
|
+
if (resolved.kind === "lane" && resolved.lane && compact) {
|
|
150
|
+
let context = "";
|
|
151
|
+
const result = await regroundLane(resolved.lane, { force: true, write: (text) => { context += text; } }, { request }).catch(() => ({ shown: false }));
|
|
152
|
+
// A Freeze written before it referenced the Clause map has no pointer to it.
|
|
153
|
+
const pointer = result.shown && !context.includes("lane gather show")
|
|
154
|
+
? `\nFull Clause map: \`nodii-dev lane gather show ${resolved.lane.key}\`; one clause in full: \`nodii-dev rules show <ID>\`.`
|
|
155
|
+
: "";
|
|
156
|
+
parts.push(result.shown ? `${context.trimEnd()}${pointer}` : `Freeze re-grounding: ${resolved.lane.key} has no initialized Freeze; run \`nodii-dev lane freeze show ${resolved.lane.key}\` (and \`nodii-dev lane gather show ${resolved.lane.key}\` for its Clause map) before continuing.`);
|
|
157
|
+
} else if (resolved.kind === "lane" && compact)
|
|
158
|
+
parts.push("Freeze re-grounding: no active Dev lane with initialized Freeze was available for this worktree; run `nodii-dev lane freeze show <key>` (and `nodii-dev lane gather show <key>` for its Clause map) before continuing.");
|
|
159
|
+
if (resolved.kind === "steward") {
|
|
160
|
+
if (compact) {
|
|
161
|
+
let context = "";
|
|
162
|
+
const result = await regroundLane(resolved.steward, { force: true, write: (text) => { context += text; } }, { request }).catch(() => ({ shown: false }));
|
|
163
|
+
if (result.shown) parts.push(`${context.trimEnd()}\nGather again now (MW1-94): \`nodii-dev lane gather ${resolved.steward.key} --delta --picker agent\`; the full Clause map: \`nodii-dev lane gather show ${resolved.steward.key}\`.`);
|
|
164
|
+
else parts.push(await stewardClauseMap(resolved.steward, request));
|
|
165
|
+
} else parts.push(await stewardClauseMap(resolved.steward, request));
|
|
166
|
+
}
|
|
167
|
+
return parts.join("\n\n");
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* UserPromptSubmit, first prompt only: what the prompt says the session is.
|
|
172
|
+
* Silent on every later prompt, and when the prompt agrees with what
|
|
173
|
+
* SessionStart already printed.
|
|
174
|
+
*/
|
|
175
|
+
export async function firstPromptText(payload, { request = devRequest, config = readConfig, env = process.env, dev = kindFromDev, readState = readKindState, state = writeKindState } = {}) {
|
|
176
|
+
const session = payload?.session_id;
|
|
177
|
+
const before = await readState(session).catch(() => null);
|
|
178
|
+
if (before?.prompted) return null;
|
|
179
|
+
const prompt = kindFromPrompt(payload?.prompt);
|
|
180
|
+
const resolved = resolveKind(await dev({ cwd: payload?.cwd ?? process.cwd(), env }, { request, config }), prompt);
|
|
181
|
+
await state(session, { kind: resolved.kind, source: resolved.source, prompted: true }).catch(() => {});
|
|
182
|
+
// SessionStart already printed this kind and nothing disagrees: say so in one line.
|
|
183
|
+
if (before?.kind === resolved.kind && !resolved.notes.length)
|
|
184
|
+
return prompt ? `Session kind: ${KIND_LABEL[resolved.kind]} (MW1-92), confirmed by the first prompt.` : null;
|
|
185
|
+
const text = await kindText(resolved, { request });
|
|
186
|
+
if (resolved.kind === "steward" && resolved.steward && before?.kind !== "steward")
|
|
187
|
+
return `${text}\n\n${await stewardClauseMap(resolved.steward, request)}`;
|
|
188
|
+
return text;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const stateDir = () => join(dirname(configPath()), STATE_DIR);
|
|
192
|
+
const statePath = (session) => join(stateDir(), `${String(session).replace(/[^A-Za-z0-9_-]/g, "_")}.json`);
|
|
193
|
+
|
|
194
|
+
export async function readKindState(session) {
|
|
195
|
+
if (!session) return null;
|
|
196
|
+
return JSON.parse(await readFile(statePath(session), "utf8"));
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/** One small file per session; files older than a week are removed as they are passed. */
|
|
200
|
+
export async function writeKindState(session, update, { now = Date.now() } = {}) {
|
|
201
|
+
if (!session) return;
|
|
202
|
+
const dir = stateDir();
|
|
203
|
+
await mkdir(dir, { recursive: true, mode: 0o700 });
|
|
204
|
+
let before = {};
|
|
205
|
+
try { before = JSON.parse(await readFile(statePath(session), "utf8")); } catch {}
|
|
206
|
+
const temporary = `${statePath(session)}.${process.pid}.tmp`;
|
|
207
|
+
await writeFile(temporary, `${JSON.stringify({ ...before, ...update, at: new Date(now).toISOString() })}\n`, { mode: 0o600 });
|
|
208
|
+
await rename(temporary, statePath(session));
|
|
209
|
+
for (const name of await readdir(dir).catch(() => [])) {
|
|
210
|
+
const path = join(dir, name);
|
|
211
|
+
const info = await stat(path).catch(() => null);
|
|
212
|
+
if (info && now - info.mtimeMs > STATE_TTL_MS) await rm(path, { force: true }).catch(() => {});
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* `nodii-dev steward register|show` (MW1-93): a steward is a lane of kind
|
|
218
|
+
* `steward` with no branch or worktree, started at once on its gather step.
|
|
219
|
+
*/
|
|
220
|
+
export async function stewardCommand(action, args, flags, { request = devRequest, config = readConfig } = {}) {
|
|
221
|
+
const current = await config();
|
|
222
|
+
if (action === "show") {
|
|
223
|
+
const steward = await activeSteward(current.agentId, { request });
|
|
224
|
+
if (!steward) throw new CliError("STEWARD_NOT_REGISTERED", "This agent has no live steward registration; `nodii-dev steward register --focus TEXT --repos R,...` makes one.", 1);
|
|
225
|
+
return { payload: { data: steward }, human: (p) => `${p.data.key} · steward · ${p.data.status}\nFocus: ${focusOf(p.data)}\nRepositories: ${(p.data.repos ?? []).join(", ")}` };
|
|
226
|
+
}
|
|
227
|
+
if (action !== "register") throw new CliError("USAGE", "steward register --focus TEXT --repos R,... [--side frontend|backend] [--key KEY] | steward show", 2);
|
|
228
|
+
const focus = String(requireFlag(flags, "focus")).trim();
|
|
229
|
+
if (!focus) throw new CliError("USAGE", "steward register --focus needs the operator's focus", 2);
|
|
230
|
+
const repos = String(requireFlag(flags, "repos")).split(",").map((repo) => repo.trim()).filter(Boolean);
|
|
231
|
+
if (!repos.length) throw new CliError("USAGE", "steward register --repos needs at least one repository", 2);
|
|
232
|
+
const side = flags.side ?? "frontend";
|
|
233
|
+
if (!["frontend", "backend", "both"].includes(side)) throw new CliError("USAGE", "steward register --side is frontend, backend or both", 2);
|
|
234
|
+
const agent = (await request("GET", `/api/v1/agents/${encode(current.agentId)}`)).data;
|
|
235
|
+
if (!agent?.machineId) throw new CliError("MACHINE_REQUIRED", "The current agent is not assigned to a machine.", 1);
|
|
236
|
+
const key = flags.key ?? `steward-${String(agent.name ?? current.agentId).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40) || current.agentId.slice(0, 8)}`;
|
|
237
|
+
await request("POST", "/api/v1/lanes", {
|
|
238
|
+
key, title: focus, kind: "steward", side, repos,
|
|
239
|
+
agentId: current.agentId, machineId: agent.machineId, issueIds: [], via: "nodii-dev",
|
|
240
|
+
});
|
|
241
|
+
const payload = await request("POST", `/api/v1/lanes/${encode(key)}/start`, { via: "nodii-dev" });
|
|
242
|
+
return { payload, human: () => `Registered steward ${key} for: ${focus}\nNext (MW1-94): \`nodii-dev lane gather ${key} --picker agent\`. A new focus is a lane amendment: \`nodii-dev lane amend ${key} --objective "<focus>" --reason TEXT\`.` };
|
|
243
|
+
}
|
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,
|
|
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] : [
|
|
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: ${
|
|
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: ${
|
|
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
|
}
|