@alori/cli 0.1.6 → 0.1.7
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 +3 -1
- package/lib/sync.mjs +16 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,7 +10,9 @@ alori push -m "New pricing page"
|
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
Alori builds each push, shows it in your workspace preview and saves it as a version. Publish it from Alori when it
|
|
13
|
-
looks right.
|
|
13
|
+
looks right. If someone else saved changes since your pull, Alori merges them with yours and pulls the result into your
|
|
14
|
+
folder; only the same lines changed on both sides stop the push, with their copy beside yours as
|
|
15
|
+
`<file>.alori-theirs` to merge. How it works: `docs/CLAUDE_CODE.md` in Alori's repository.
|
|
14
16
|
|
|
15
17
|
`alori dev` runs the app from your files against its real backend and data: screens and text change as you save,
|
|
16
18
|
backend changes (`convex/`) reach it with `alori push`.
|
package/lib/sync.mjs
CHANGED
|
@@ -313,7 +313,6 @@ export async function push(dir, message) {
|
|
|
313
313
|
const sent = await call("/code/push", { method: "POST", body });
|
|
314
314
|
if (!sent.ok) {
|
|
315
315
|
const error = sent.body?.error;
|
|
316
|
-
if (error === "conflicts") fail(`Someone saved changes to these files since your pull:\n${sent.body.paths.map((path) => ` ${path}`).join("\n")}\nRun alori pull, merge, then push again.`);
|
|
317
316
|
if (error === "notEditable") fail(`These files are Alori's and change for every app, so they can't be pushed:\n${sent.body.paths.map((path) => ` ${path}`).join("\n")}\nPut the change in the app's own files instead.`);
|
|
318
317
|
if (error === "busy") fail("Alori is already building this app (the builder or another push). Try again in a minute.");
|
|
319
318
|
if (error === "noCredits") fail("You're out of credits. Add credits in Alori, then push again.");
|
|
@@ -357,11 +356,25 @@ export async function push(dir, message) {
|
|
|
357
356
|
// Others saved too between the pull and this save: this folder lacks their changes, so the next push pulls first.
|
|
358
357
|
writeState(dir, { ...state, version: pushed.version, hashes, ...(pushed.behind ? { needsPull: true } : {}) });
|
|
359
358
|
console.log(`Saved as version ${pushed.version} in ${secondsSince(started)}. It's in the preview: publish it in Alori when you're ready.`);
|
|
360
|
-
|
|
359
|
+
const merged = pushed.merged ?? [];
|
|
360
|
+
if (merged.length > 0) {
|
|
361
|
+
console.log("Someone else changed these files too. Their changes and yours were merged:");
|
|
362
|
+
for (const path of merged) console.log(` ${path}`);
|
|
363
|
+
}
|
|
364
|
+
if (pushed.behind) {
|
|
365
|
+
// Bring the merged files and everyone else's changes here, so this folder holds what was just saved.
|
|
366
|
+
console.log("\nSomeone else saved changes since your pull. Bringing them here…");
|
|
367
|
+
await pullOver(dir, readState(dir), me);
|
|
368
|
+
}
|
|
361
369
|
return;
|
|
362
370
|
}
|
|
363
371
|
if (pushed.status === "refused" || pushed.status === "failed") console.log(`Stopped after ${secondsSince(started)}.`);
|
|
364
|
-
if (pushed.status === "refused") fail(
|
|
372
|
+
if (pushed.status === "refused" && !pushed.conflicts?.length) fail(`${pushed.error ?? "Nothing was saved."}`);
|
|
373
|
+
if (pushed.status === "refused") {
|
|
374
|
+
console.log(`Someone else changed the same lines in these files, so nothing was saved:\n${pushed.conflicts.map((path) => ` ${path}`).join("\n")}\n\nPulling their changes so you can merge them…`);
|
|
375
|
+
await pullOver(dir, state, me);
|
|
376
|
+
fail("Merge the files above, delete the .alori-theirs files, then push again.");
|
|
377
|
+
}
|
|
365
378
|
if (pushed.status === "failed") fail(`The build failed, so nothing was saved:\n${pushed.error ?? ""}`);
|
|
366
379
|
}
|
|
367
380
|
}
|