@genex-ai/cli-demo 1.6.6-dev.439 → 1.6.7-dev.441

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 CHANGED
@@ -2045,13 +2045,13 @@ async function runLink(opts) {
2045
2045
  log.dim(` saved ${c.cyan(metaPath)}`);
2046
2046
  await writeGameConfigFiles(meta, log);
2047
2047
  await ensureSlugEnv(project.slug, log);
2048
+ const remote = await readRemoteSource(apiUrl, token, project.id);
2049
+ if (remote?.stagingCommit) meta.stagingCommit = remote.stagingCommit;
2048
2050
  if (cloned) {
2049
- const remote = await readRemoteSource(apiUrl, token, project.id);
2050
2051
  const tree = await sourceTreeHash(process.cwd());
2051
- if (remote?.stagingCommit) meta.stagingCommit = remote.stagingCommit;
2052
2052
  if (tree) meta.sourceTree = tree;
2053
- await writeProject(meta);
2054
2053
  }
2054
+ await writeProject(meta);
2055
2055
  log.plain("");
2056
2056
  log.success(
2057
2057
  `Linked. This folder now updates ${c.cyan(project.slug)} \u2014 \`npx genex preview\` / \`publish\` ship to the same live game.`
@@ -2208,7 +2208,7 @@ async function runPull(opts) {
2208
2208
  if (tree2 !== meta.sourceTree) {
2209
2209
  log.error("This folder has changes that were never deployed.");
2210
2210
  log.dim(` ${c.cyan("npx genex preview")} ships them first (add ${c.cyan("--force")} if it says another device updated this)`);
2211
- log.dim(` ${c.cyan("npx genex pull --force")} throws them away and takes the draft`);
2211
+ log.dim(` ${c.cyan("npx genex pull --force")} takes the draft and keeps a copy of what is here`);
2212
2212
  process.exitCode = 1;
2213
2213
  return;
2214
2214
  }
@@ -2233,7 +2233,13 @@ async function runPull(opts) {
2233
2233
  return;
2234
2234
  }
2235
2235
  await fs13.rm(path13.join(fresh, ".git"), { recursive: true, force: true });
2236
+ const kept = await keepReplaced(cwd, log);
2236
2237
  await replaceTree(cwd, fresh);
2238
+ if (kept) {
2239
+ log.plain("");
2240
+ log.info(`What was here is kept at ${c.cyan(path13.relative(cwd, kept) || kept)}`);
2241
+ log.dim(" Nothing was thrown away \u2014 re-apply from there, or delete it when you are done.");
2242
+ }
2237
2243
  } finally {
2238
2244
  await fs13.rm(staging, { recursive: true, force: true }).catch(() => {
2239
2245
  });
@@ -2252,6 +2258,23 @@ async function runPull(opts) {
2252
2258
  log.success(`Pulled ${c.cyan(meta.slug)}${grant.sourceRef === "preview" ? " (draft)" : ""}.`);
2253
2259
  log.dim(` Run ${c.cyan("npm install")} if dependencies changed, then keep building.`);
2254
2260
  }
2261
+ async function keepReplaced(cwd, log) {
2262
+ const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
2263
+ const dest = path13.join(cwd, ".genex", `replaced-${stamp}`);
2264
+ try {
2265
+ const entries = (await fs13.readdir(cwd)).filter((e) => !isMachineLocal(e));
2266
+ if (entries.length === 0) return null;
2267
+ await fs13.mkdir(dest, { recursive: true });
2268
+ for (const entry of entries) {
2269
+ await fs13.cp(path13.join(cwd, entry), path13.join(dest, entry), { recursive: true });
2270
+ }
2271
+ return dest;
2272
+ } catch (err) {
2273
+ log.warn("Couldn't keep a copy of what's being replaced \u2014 continuing with the pull.");
2274
+ log.dim(` ${String(err)}`);
2275
+ return null;
2276
+ }
2277
+ }
2255
2278
  async function replaceTree(dest, src) {
2256
2279
  for (const entry of await fs13.readdir(dest)) {
2257
2280
  if (isMachineLocal(entry)) continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genex-ai/cli-demo",
3
- "version": "1.6.6-dev.439",
3
+ "version": "1.6.7-dev.441",
4
4
  "description": "Set up your project's agent workspace (.claude/.codex/.cursor in the game folder), authorize, create a game project, generate AI assets, and publish (genex CLI).",
5
5
  "type": "module",
6
6
  "bin": {
@@ -182,9 +182,23 @@ overwriting the other one, and tells you both ways forward:
182
182
  npx genex preview --force — keep yours and replace theirs
183
183
  ```
184
184
 
185
- Pick one deliberately: `pull` throws away what is in this folder, `--force`
186
- throws away what the other machine put on staging. **Ask the user which**, and
187
- say plainly which side is about to be lost — don't guess for them.
185
+ **Prefer taking their work and redoing yours on top.** You know what you just
186
+ changed, so you can re-apply it which no merge tool could do for you, and which
187
+ loses nothing:
188
+
189
+ ```bash
190
+ npx genex pull --force # takes their version; keeps what was here under .genex/replaced-*
191
+ # redo your change on the new base, then:
192
+ npx genex preview
193
+ ```
194
+
195
+ `pull --force` never deletes: what was in the folder is copied to
196
+ `.genex/replaced-<timestamp>/` first, so you can diff against it while re-applying.
197
+
198
+ Use `preview --force` instead only when the user says their side should win.
199
+ Either way **say which version you are keeping before you run it** — both commands
200
+ are irreversible for one side, and the user may know something you don't about what
201
+ is on the other machine.
188
202
 
189
203
  `link` never creates a project: it signs in if needed (the browser opens once)
190
204
  and rewrites the local link (source pushes authorize over HTTPS, so there's no