@vatio-ai/cli 0.88.0 → 0.90.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 CHANGED
@@ -71,6 +71,7 @@ login | logout Authorize this machine in a browser, or revoke and f
71
71
  doctor Node, config, workspace and token status
72
72
 
73
73
  push Validate the workspace, then update preview
74
+ pull [--env NAME] Write the deployed agent back into vatio.yml and tools/
74
75
  publish Take preview live, once `vatio test` has tested it
75
76
  diff [--env NAME] What this directory would change
76
77
  status Preview and live deployment state
package/bin/vatio.mjs CHANGED
@@ -10,7 +10,7 @@ import { UserError, fail } from "../lib/support.mjs";
10
10
  import { helpText } from "../lib/help.mjs";
11
11
  import { login, logout } from "../lib/commands/auth.mjs";
12
12
  import { configCommand, doctor, init, version, whoami } from "../lib/commands/misc.mjs";
13
- import { diff, publish, push, rollback, status } from "../lib/commands/deploy.mjs";
13
+ import { diff, publish, pull, push, rollback, status } from "../lib/commands/deploy.mjs";
14
14
  import { env } from "../lib/commands/env.mjs";
15
15
  import { keys, secrets, tokens } from "../lib/commands/workspace-admin.mjs";
16
16
  import { templates, webhooks } from "../lib/commands/webhooks.mjs";
@@ -29,9 +29,6 @@ import { beginRun, isCodingAgent, reportRun, telemetryEnabled } from "../lib/tel
29
29
  // Commands that existed and are gone, answered by name rather than as
30
30
  // unknown: removed from the product, or what npm does now.
31
31
  const RETIRED = {
32
- pull: "was removed: a deployed manifest only ever comes from a push, so it could never\n" +
33
- "hand back anything your repository did not already have. Use `vatio diff --env live`,\n" +
34
- "or read the manifest at GET /api/developer/v1/:slug/manifest.",
35
32
  issue: "was removed: report a problem on the public repository it belongs to --\n" +
36
33
  "https://github.com/vatio-ai/cli/issues (or sdk, ios, ruby under github.com/vatio-ai).",
37
34
  widget: "was removed: `vatio env` prints the snippet and its token, and the look is edited in\n" +
@@ -81,6 +78,8 @@ async function run(command, args) {
81
78
  return await init(config, args);
82
79
  case "push":
83
80
  return await push(config, args);
81
+ case "pull":
82
+ return await pull(config, args);
84
83
  case "publish":
85
84
  return await publish(config, args);
86
85
  case "rollback":
@@ -39,13 +39,26 @@ export class ApiClient extends HttpClient {
39
39
  return this.post("/check", body);
40
40
  }
41
41
 
42
- pushPreview({ manifest, gitSha = null, gitBranch = null, createdBy = null, environment = null, force = false }) {
42
+ // `baseDeploymentId`: the deployment the files were last made to match. The
43
+ // platform refuses the push (409 preview_edited_outside) while preview holds
44
+ // edits made outside the files since then, or any at all without one,
45
+ // unless `force`.
46
+ pushPreview({
47
+ manifest,
48
+ gitSha = null,
49
+ gitBranch = null,
50
+ createdBy = null,
51
+ environment = null,
52
+ force = false,
53
+ baseDeploymentId = null
54
+ }) {
43
55
  const body = { manifest };
44
56
  if (gitSha) body.git_sha = gitSha;
45
57
  if (gitBranch) body.git_branch = gitBranch;
46
58
  if (createdBy) body.created_by = createdBy;
47
59
  if (environment) body.environment = environment;
48
60
  if (force) body.force = true;
61
+ if (Number.isInteger(baseDeploymentId)) body.base_deployment_id = baseDeploymentId;
49
62
  return this.put("/push", body);
50
63
  }
51
64
 
@@ -105,7 +105,7 @@ function jsonlIn(dir) {
105
105
  .map((name) => {
106
106
  const path = join(dir, name);
107
107
  const stat = statSync(path);
108
- return { id: name.slice(0, -".jsonl".length), path, bytes: stat.size, modifiedAt: stat.mtimeMs };
108
+ return { agent: "claude-code", id: name.slice(0, -".jsonl".length), path, bytes: stat.size, modifiedAt: stat.mtimeMs };
109
109
  })
110
110
  .sort((a, b) => b.modifiedAt - a.modifiedAt);
111
111
  }
@@ -207,7 +207,8 @@ function scrub(value, counts) {
207
207
 
208
208
  const HOME = homedir();
209
209
 
210
- function redact(text, counts) {
210
+ // Also what codex-session.mjs cleans a Codex session's text with.
211
+ export function redact(text, counts) {
211
212
  let result = text;
212
213
  for (const [pattern, replacement] of SECRET_PATTERNS) {
213
214
  result = result.replace(pattern, (...match) => {
@@ -0,0 +1,223 @@
1
+ // The coding agent's own session, as Codex keeps it on this machine: one JSONL
2
+ // file per thread under $CODEX_HOME/sessions/YYYY/MM/DD/, named
3
+ // rollout-<time>-<thread id>.jsonl, with $CODEX_HOME at ~/.codex unless it is
4
+ // set. Codex gives every command it runs the thread's id in CODEX_THREAD_ID.
5
+ // Each line is {timestamp, type, payload}; the first is the session_meta, with
6
+ // the directory the session was started in.
7
+ //
8
+ // The format is Codex's and changes between its releases, so nothing here
9
+ // depends on more of it than it has to: a line is kept or dropped by its
10
+ // `type`, and everything a kept line carries is passed through as it is.
11
+
12
+ import { closeSync, openSync, readdirSync, readFileSync, readSync, statSync } from "node:fs";
13
+ import { homedir } from "node:os";
14
+ import { dirname, join, resolve } from "node:path";
15
+
16
+ import { redact } from "./claude-session.mjs";
17
+
18
+ // What the agent and the developer said and did, and where. Everything else is
19
+ // Codex's bookkeeping: events that repeat the items, token counts, turn
20
+ // settings, compaction summaries of items the file still holds.
21
+ const KEPT_TYPES = new Set(["session_meta", "response_item"]);
22
+
23
+ // Codex's own system prompt and tool list, as long as a conversation, and the
24
+ // opaque encrypted copies of reasoning and arguments.
25
+ const DROPPED_META_KEYS = ["base_instructions", "dynamic_tools"];
26
+ const DROPPED_KEYS = new Set(["encrypted_content", "encrypted_function_args"]);
27
+
28
+ // Reading every session's first line to find the ones for a directory is the
29
+ // slow part; the newest are the ones anyone sends.
30
+ const SCANNED = 200;
31
+
32
+ const THREAD_ID = /^rollout-.+-([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:_[0-9a-f-]+)?\.jsonl$/i;
33
+
34
+ export function codexHome() {
35
+ return process.env.CODEX_HOME || join(homedir(), ".codex");
36
+ }
37
+
38
+ // The sessions Codex kept for this directory, or for the nearest parent it was
39
+ // started in, newest first.
40
+ export function sessionsFor(startDir) {
41
+ const byDir = new Map();
42
+ for (const session of rollouts().slice(0, SCANNED)) {
43
+ const cwd = metaOf(session.path)?.cwd;
44
+ if (typeof cwd !== "string") continue;
45
+ const key = dirKey(cwd);
46
+ byDir.set(key, [...(byDir.get(key) ?? []), session]);
47
+ }
48
+
49
+ let dir = resolve(startDir);
50
+ for (;;) {
51
+ const sessions = byDir.get(dirKey(dir));
52
+ if (sessions) return sessions;
53
+ const parent = dirname(dir);
54
+ if (parent === dir) return [];
55
+ dir = parent;
56
+ }
57
+ }
58
+
59
+ export function sessionById(id) {
60
+ return rollouts().find((session) => session.id.startsWith(id)) ?? null;
61
+ }
62
+
63
+ // What a session is about, without cleaning it: for --list, and for picking
64
+ // the newest session that has a conversation in it.
65
+ export function describe(session) {
66
+ let firstPrompt = null;
67
+ let messages = 0;
68
+ let cwd = null;
69
+ for (const line of lines(session.path)) {
70
+ if (line.type === "session_meta") cwd ??= line.payload?.cwd ?? null;
71
+ const item = line.type === "response_item" ? line.payload : null;
72
+ if (item?.type !== "message" || !["user", "assistant"].includes(item.role)) continue;
73
+ messages += 1;
74
+ if (item.role === "user") firstPrompt ??= promptText(item.content);
75
+ }
76
+ return { ...session, title: firstPrompt, messages, cwd };
77
+ }
78
+
79
+ // The session as it is sent: only what was said and done, without images,
80
+ // with anything that looks like a secret, an email or a phone replaced and the
81
+ // home directory as ~.
82
+ export function clean(session) {
83
+ const kept = [];
84
+ const counts = { messages: 0, images: 0, redactions: 0, personal: 0 };
85
+ let startedAt = null;
86
+ let endedAt = null;
87
+ let gitBranch = null;
88
+ let cwd = null;
89
+
90
+ for (const line of lines(session.path)) {
91
+ if (!KEPT_TYPES.has(line.type)) continue;
92
+ if (line.type === "session_meta" && line.payload && typeof line.payload === "object") {
93
+ for (const key of DROPPED_META_KEYS) delete line.payload[key];
94
+ gitBranch = line.payload.git?.branch ?? gitBranch;
95
+ }
96
+
97
+ const scrubbed = scrub(line, counts);
98
+ const item = line.payload;
99
+ if (line.type === "response_item" && item?.type === "message" && ["user", "assistant"].includes(item.role)) {
100
+ counts.messages += 1;
101
+ }
102
+ if (line.timestamp) {
103
+ startedAt ??= line.timestamp;
104
+ endedAt = line.timestamp;
105
+ }
106
+ if (line.type === "session_meta") cwd ??= scrubbed.payload?.cwd ?? null;
107
+ kept.push(JSON.stringify(scrubbed));
108
+ }
109
+
110
+ return {
111
+ jsonl: kept.length > 0 ? `${kept.join("\n")}\n` : "",
112
+ ...counts,
113
+ startedAt,
114
+ endedAt,
115
+ gitBranch,
116
+ cwd
117
+ };
118
+ }
119
+
120
+ // Every session file, newest first. Compressed ones (.jsonl.zst) are old ones
121
+ // Codex packed away, and are left out.
122
+ function rollouts() {
123
+ const root = join(codexHome(), "sessions");
124
+ const files = [];
125
+ for (const year of listDir(root)) {
126
+ for (const month of listDir(join(root, year))) {
127
+ for (const day of listDir(join(root, year, month))) {
128
+ const dir = join(root, year, month, day);
129
+ for (const name of listDir(dir)) {
130
+ const match = THREAD_ID.exec(name);
131
+ if (!match) continue;
132
+ const path = join(dir, name);
133
+ const stat = statSync(path);
134
+ files.push({ agent: "codex", id: match[1].toLowerCase(), path, bytes: stat.size, modifiedAt: stat.mtimeMs });
135
+ }
136
+ }
137
+ }
138
+ }
139
+ return files.sort((a, b) => b.modifiedAt - a.modifiedAt);
140
+ }
141
+
142
+ // The first line alone, which carries the system prompt and can be long, but
143
+ // never the whole file, which can be many megabytes.
144
+ function metaOf(path) {
145
+ let fd;
146
+ try {
147
+ fd = openSync(path, "r");
148
+ const chunk = Buffer.alloc(64 * 1024);
149
+ const parts = [];
150
+ for (let total = 0; total < 4 * 1024 * 1024; ) {
151
+ const read = readSync(fd, chunk, 0, chunk.length, total);
152
+ if (read === 0) break;
153
+ const newline = chunk.subarray(0, read).indexOf(10);
154
+ parts.push(Buffer.from(chunk.subarray(0, newline === -1 ? read : newline)));
155
+ if (newline !== -1) break;
156
+ total += read;
157
+ }
158
+ const line = JSON.parse(Buffer.concat(parts).toString("utf8"));
159
+ return line?.type === "session_meta" ? line.payload : null;
160
+ } catch {
161
+ return null;
162
+ } finally {
163
+ if (fd !== undefined) closeSync(fd);
164
+ }
165
+ }
166
+
167
+ function* lines(path) {
168
+ for (const text of readFileSync(path, "utf8").split("\n")) {
169
+ if (text.trim() === "") continue;
170
+ try {
171
+ const line = JSON.parse(text);
172
+ if (line && typeof line === "object") yield line;
173
+ } catch {
174
+ // A line cut off while Codex was writing it: the session this command
175
+ // runs in is still being written.
176
+ }
177
+ }
178
+ }
179
+
180
+ function scrub(value, counts) {
181
+ if (typeof value === "string") return redact(value, counts);
182
+ if (Array.isArray(value)) return value.map((item) => scrub(item, counts));
183
+ if (!value || typeof value !== "object") return value;
184
+
185
+ // Pictures, base64 inline in a data: URL: screenshots of whatever was on
186
+ // screen.
187
+ if (value.type === "input_image") {
188
+ counts.images += 1;
189
+ return { type: value.type, omitted: true };
190
+ }
191
+
192
+ return Object.fromEntries(
193
+ Object.entries(value)
194
+ .filter(([key]) => !DROPPED_KEYS.has(key))
195
+ .map(([key, item]) => [key, scrub(item, counts)])
196
+ );
197
+ }
198
+
199
+ // Codex puts its own context in user messages too: the environment as a tag,
200
+ // and AGENTS.md under a heading of its own.
201
+ function promptText(content) {
202
+ const text = Array.isArray(content)
203
+ ? content.find((block) => block?.type === "input_text")?.text
204
+ : typeof content === "string" ? content : null;
205
+ if (!text) return null;
206
+ const trimmed = text.trimStart();
207
+ if (trimmed.startsWith("<") || trimmed.startsWith("# AGENTS.md")) return null;
208
+ return text.replace(/\s+/g, " ").trim();
209
+ }
210
+
211
+ // Windows paths compare without case, as Windows does.
212
+ function dirKey(path) {
213
+ const resolved = resolve(path);
214
+ return process.platform === "win32" ? resolved.toLowerCase() : resolved;
215
+ }
216
+
217
+ function listDir(dir) {
218
+ try {
219
+ return readdirSync(dir).sort().reverse();
220
+ } catch {
221
+ return [];
222
+ }
223
+ }
@@ -1,24 +1,35 @@
1
- // push / publish / rollback / status / diff.
1
+ // push / pull / publish / rollback / status / diff.
2
2
  //
3
3
  // Every one of them is HTTP. The workspace is parsed by the platform
4
4
  // (POST /deploy/check), so what is left here is: read the directory, send it,
5
5
  // print what came back.
6
6
  //
7
- // `pull` is deliberately not here yet. It is the one command that writes over
8
- // the developer's own files, and the Ruby version carries real subtlety doing
9
- // it -- a comment where the logo would go, because a revision keeps the name
10
- // and digest but never the bytes; `identity.pub` written back out; a specific
11
- // key order in the file it emits. Porting that from memory is how you ship a
12
- // command that quietly mangles a workspace, so it comes with a round-trip test
13
- // (push, pull, diff clean) rather than with this.
7
+ // `pull` is the exception, the one command that writes over the developer's
8
+ // own files. It is back because the files stopped being the only writer: from
9
+ // the Vatio MCP, in Claude or ChatGPT, people edit the agent itself, and each
10
+ // edit lands in preview as a deployment of its own. What it writes is narrow
11
+ // on purpose (lib/pull.mjs): each tools/KEY.yml exactly as the platform holds
12
+ // it, and only the `agent:` block of the vatio.yml already on disk, key by
13
+ // key, because a revision keeps neither that file's comments nor `auth:` the
14
+ // way the file spells it. And it wants a clean git tree, so that git, not this
15
+ // CLI, is what gives back whatever it replaced.
16
+ //
17
+ // The two directions meet in the base deployment: the one the files were last
18
+ // made to match, by a push or a pull, kept in the config file. A push sends
19
+ // it, so the platform can refuse to overwrite edits the files have never seen.
20
+
21
+ import { mkdirSync, rmSync, writeFileSync } from "node:fs";
22
+ import { dirname, join } from "node:path";
14
23
 
15
24
  import { stringify as stringifyYaml } from "yaml";
16
25
 
17
26
  import { buildBundle, BundleError } from "../bundle.mjs";
18
27
  import { ApiClient, CliClient } from "../api-client.mjs";
19
- import { NotFoundError, UnprocessableError } from "../http.mjs";
28
+ import { ConflictError, NotFoundError, UnprocessableError } from "../http.mjs";
29
+ import { MANIFEST_FILE } from "../workspace.mjs";
30
+ import { PullError, planPull } from "../pull.mjs";
20
31
  import { deviceLogin } from "./auth.mjs";
21
- import { detectGitBranch, detectGitSha, fail, paint, takeEnv, takeFlag, takeValue } from "../support.mjs";
32
+ import { detectGitBranch, detectGitSha, fail, gitChanges, paint, takeEnv, takeFlag, takeValue } from "../support.mjs";
22
33
 
23
34
  // The first command that makes something exist on a server, so the first one
24
35
  // that needs to know whose it is.
@@ -87,8 +98,9 @@ export async function push(config, args) {
87
98
  // explicitly would make a bare `vatio push` and `vatio push --env preview`
88
99
  // two different requests that only happen to agree today.
89
100
  const environment = takeEnv(args, { fallback: null });
90
- // Replaces an unpublished push from another branch, which the platform
91
- // otherwise refuses (preview_has_unpublished_push).
101
+ // Replaces an unpublished push from another branch, or edits made outside
102
+ // the files, which the platform otherwise refuses
103
+ // (preview_has_unpublished_push, preview_edited_outside).
92
104
  const force = takeFlag(args, "--force");
93
105
  const workspace = config.resolveWorkspaceRequired();
94
106
 
@@ -110,14 +122,24 @@ export async function push(config, args) {
110
122
  if (!check.ok) fail(`push aborted: check failed (${asArray(check.errors).length} error(s))`);
111
123
 
112
124
  const client = deployClient(config, workspace);
113
- const payload = await client.pushPreview({
114
- manifest: check.manifest,
115
- gitSha: detectGitSha(config.workspaceRootRequired()),
116
- gitBranch: detectGitBranch(config.workspaceRootRequired()),
117
- createdBy: process.env.USER ?? null,
118
- environment,
119
- force
120
- });
125
+ const baseUrl = config.resolveBaseUrl();
126
+ let payload;
127
+ try {
128
+ payload = await client.pushPreview({
129
+ manifest: check.manifest,
130
+ gitSha: detectGitSha(config.workspaceRootRequired()),
131
+ gitBranch: detectGitBranch(config.workspaceRootRequired()),
132
+ createdBy: process.env.USER ?? null,
133
+ environment,
134
+ force,
135
+ baseDeploymentId: config.baseDeploymentFor({ baseUrl, workspace })
136
+ });
137
+ } catch (error) {
138
+ if (error instanceof ConflictError && error.errorKey === "preview_edited_outside") fail(editedOutsideMessage(error));
139
+ throw error;
140
+ }
141
+ // What the files match now, so the next push is built on it.
142
+ config.rememberBaseDeployment({ baseUrl, workspace, deploymentId: payload.deployment_id });
121
143
 
122
144
  const landedOn = payload.environment ?? "preview";
123
145
  console.log(`Pushed deployment #${payload.deployment_id} to ${landedOn} (git_sha=${JSON.stringify(payload.git_sha ?? null)})`);
@@ -144,6 +166,114 @@ function printNotices(payload) {
144
166
  }
145
167
  }
146
168
 
169
+ // Refused because preview holds edits the files have never seen: which, and
170
+ // the two ways forward. The platform's message says all of it in one line,
171
+ // for releases that print only that; with the list to go by, this one says
172
+ // it a line per edit instead of repeating it.
173
+ function editedOutsideMessage(error) {
174
+ const edits = asArray(error.body.edits);
175
+ const count = edits.length === 1 ? "a change" : `${edits.length} changes`;
176
+ const lines = edits.length === 0 ? [error.message] : [`Preview has ${count} made outside your files that this push would overwrite:`];
177
+ for (const edit of edits) lines.push(` ${editLine(edit)}`);
178
+ const them = edits.length === 1 ? "it" : "them";
179
+ lines.push(
180
+ "",
181
+ `Run \`vatio pull\` to bring ${them} into your files, review with \`git diff\`, and push again.`,
182
+ `\`vatio push --force\` overwrites ${them} instead.`
183
+ );
184
+ return lines.join("\n");
185
+ }
186
+
187
+ // `#42 by ivan@x.cl via Claude, 2026-10-16T12:00:00Z: instructions, tool my_orders`
188
+ function editLine(edit) {
189
+ const who = edit?.created_by ? ` by ${edit.created_by}` : "";
190
+ const when = edit?.created_at ? `, ${edit.created_at}` : "";
191
+ const what = edit?.summary ? `: ${edit.summary}` : "";
192
+ return `#${edit?.deployment_id ?? "?"}${who}${when}${what}`;
193
+ }
194
+
195
+ // The deployed agent, back in the files: what an edit made from the Vatio MCP
196
+ // changed, so the next push carries it rather than undoing it. Preview by
197
+ // default, since that is where those edits land.
198
+ export async function pull(config, args) {
199
+ const environment = takeEnv(args, { fallback: "preview" });
200
+ // Writes even over uncommitted changes, or outside git.
201
+ const force = takeFlag(args, "--force");
202
+ if (args.length > 0) fail(`vatio pull: unexpected ${JSON.stringify(args[0])} (it takes --env NAME and --force)`);
203
+
204
+ const workspace = config.resolveWorkspaceRequired();
205
+ const root = config.workspaceRootRequired();
206
+ const client = deployClient(config, workspace);
207
+ if (!force) refuseUnkeptChanges(root);
208
+
209
+ let payload;
210
+ try {
211
+ payload = await client.deployedManifest({ environment });
212
+ } catch (error) {
213
+ if (error instanceof NotFoundError) {
214
+ fail(`Nothing to pull: ${workspace} has no ${environment} deployment yet. \`vatio push\` makes one from your files.`);
215
+ }
216
+ throw error;
217
+ }
218
+
219
+ let changes;
220
+ try {
221
+ changes = planPull(root, payload.manifest);
222
+ } catch (error) {
223
+ if (error instanceof PullError) fail(`vatio pull: ${error.message}`);
224
+ throw error;
225
+ }
226
+
227
+ const deployment = `deployment #${payload.deployment_id} (${payload.environment ?? environment})`;
228
+ const edits = asArray(payload.edited_outside_push);
229
+ if (edits.length > 0) {
230
+ console.log(`Edits made outside your files, in ${deployment}:`);
231
+ for (const edit of edits) console.log(` ${editLine(edit)}`);
232
+ console.log("");
233
+ }
234
+
235
+ for (const change of changes) {
236
+ const path = join(root, change.path);
237
+ if (change.action === "deleted") {
238
+ rmSync(path, { force: true });
239
+ } else {
240
+ mkdirSync(dirname(path), { recursive: true });
241
+ writeFileSync(path, change.content);
242
+ }
243
+ console.log(`${change.action} ${change.path}`);
244
+ }
245
+ config.rememberBaseDeployment({ baseUrl: config.resolveBaseUrl(), workspace, deploymentId: payload.deployment_id });
246
+
247
+ if (changes.length === 0) {
248
+ console.log(`Your files already match ${deployment}.`);
249
+ } else {
250
+ console.log(`Your files now match ${deployment}. Review with \`git diff\`, then \`vatio push\`.`);
251
+ }
252
+ }
253
+
254
+ // Pull writes over vatio.yml and tools/, so what they hold now has to be
255
+ // somewhere it can come back from: committed to git.
256
+ function refuseUnkeptChanges(root) {
257
+ const changed = gitChanges(root, [MANIFEST_FILE, "tools"]);
258
+ if (changed === null) {
259
+ fail(
260
+ `vatio pull writes over ${MANIFEST_FILE} and tools/, and this workspace is not in a git repository,\n` +
261
+ "so nothing could give you back what they hold now. Commit them to git first, or run\n" +
262
+ "`vatio pull --force` to overwrite them anyway."
263
+ );
264
+ }
265
+ if (changed.length > 0) {
266
+ fail(
267
+ [
268
+ `vatio pull writes over ${MANIFEST_FILE} and tools/, and they have changes git has not kept:`,
269
+ ...changed.map((line) => ` ${line}`),
270
+ "",
271
+ "Commit or stash them first, so git keeps what you had, or run `vatio pull --force` to overwrite them."
272
+ ].join("\n")
273
+ );
274
+ }
275
+ }
276
+
147
277
  export async function publish(config, args) {
148
278
  // Here `--env` names the environment being promoted, not a destination: the
149
279
  // destination of a publish is always live, and what goes there is preview,
@@ -212,6 +342,17 @@ export async function status(config) {
212
342
  `reads it — add \`knowledge: [${base.name}]\` to vatio.yml and push.`
213
343
  );
214
344
  }
345
+ // Edits from the Vatio MCP that preview carries, no push has written over
346
+ // and these files have not pulled: the next push is refused until they are.
347
+ const base = config.baseDeploymentFor({ baseUrl: config.resolveBaseUrl(), workspace });
348
+ const edits = asArray(payload.preview_edited_outside_push).filter(
349
+ (edit) => base == null || Number(edit.deployment_id) > base
350
+ );
351
+ if (edits.length > 0) {
352
+ console.error(`Preview has ${edits.length === 1 ? "a change" : `${edits.length} changes`} made outside your files:`);
353
+ for (const edit of edits) console.error(` ${editLine(edit)}`);
354
+ console.error(" `vatio pull` brings them into your files before your next push.");
355
+ }
215
356
  printVatioSide(payload.vatio);
216
357
  }
217
358