@cellajs/cli 0.1.1 → 0.2.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 +10 -8
- package/dist/index.js +13 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -79,16 +79,18 @@ pnpm cella sync --track branch # follow the tip once, without editing config
|
|
|
79
79
|
main ──▶ cella/sync/<stamp> ──(3-way merge)──▶ PR ──(squash)──▶ main
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
-
It runs a real git 3-way merge
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
82
|
+
It runs a real git 3-way merge. `sync` is **idempotent and staged**: each run advances the sync
|
|
83
|
+
one stage, and the run that commits never ships — the pause on the committed branch is where
|
|
84
|
+
drift triage (`pnpm cella analyze` diffs committed HEAD) and follow-up commits happen.
|
|
85
|
+
|
|
86
|
+
1. **First run** cuts the branch and merges. A clean merge is committed right away: dependencies
|
|
87
|
+
are reconciled (`pnpm install` + `pnpm check`), everything is staged, and the delta is
|
|
88
|
+
committed — then the run stops on the branch. A conflicted merge stops earlier so you can
|
|
89
|
+
resolve in your IDE (`git add` the resolved files) and re-run to commit.
|
|
90
|
+
2. **Final re-run `pnpm cella sync`** on the committed branch ships it: pushes to `origin`,
|
|
89
91
|
opens a PR into `main` (via `gh`), and switches you back to `main`.
|
|
90
92
|
|
|
91
|
-
When
|
|
93
|
+
When the commit stage runs, the in-progress merge state (`MERGE_HEAD`) is discarded, so the staged delta
|
|
92
94
|
collapses into a **single-parent commit** (`chore: sync upstream cella <sha>`). This keeps the PR
|
|
93
95
|
to one clean commit with the incremental diff — a two-parent merge commit would instead list the
|
|
94
96
|
upstream branch's entire history, because the fork doesn't share pushed ancestry with upstream
|
package/dist/index.js
CHANGED
|
@@ -215,7 +215,7 @@ import process4 from "process";
|
|
|
215
215
|
// package.json
|
|
216
216
|
var package_default = {
|
|
217
217
|
name: "@cellajs/cli",
|
|
218
|
-
version: "0.
|
|
218
|
+
version: "0.2.0",
|
|
219
219
|
private: false,
|
|
220
220
|
license: "MIT",
|
|
221
221
|
description: "CLI for managing your monorepo and syncing with upstream Cella.",
|
|
@@ -646,9 +646,7 @@ function printSyncComplete(result, options = {}) {
|
|
|
646
646
|
if (options.stagedBranch) {
|
|
647
647
|
console.info(`${colors_default.green("\u2713")} Sync merge staged on '${options.stagedBranch}'`);
|
|
648
648
|
console.info(
|
|
649
|
-
colors_default.dim(
|
|
650
|
-
` ${updated} files updated, ${merged} auto-merged, ${conflicts} conflicts. Review, then rerun \`pnpm cella sync\` to finish.`
|
|
651
|
-
)
|
|
649
|
+
colors_default.dim(` ${updated} files updated, ${merged} auto-merged, ${conflicts} conflicts. Committing next...`)
|
|
652
650
|
);
|
|
653
651
|
} else {
|
|
654
652
|
console.info(`${colors_default.green("\u2713")} sync complete`);
|
|
@@ -4114,7 +4112,7 @@ async function runSyncCycle(config) {
|
|
|
4114
4112
|
}
|
|
4115
4113
|
return { status: "staged", branch };
|
|
4116
4114
|
}
|
|
4117
|
-
async function
|
|
4115
|
+
async function commitSyncMerge(config, branch) {
|
|
4118
4116
|
const { forkPath } = config;
|
|
4119
4117
|
const conflicts = await getConflictedFiles(forkPath);
|
|
4120
4118
|
console.info();
|
|
@@ -4137,7 +4135,12 @@ async function resumeSyncMerge(config, branch) {
|
|
|
4137
4135
|
await commitSquash(forkPath, message);
|
|
4138
4136
|
console.info();
|
|
4139
4137
|
console.info(colors_default.green(`committed the sync on '${branch}' as '${message}'.`));
|
|
4140
|
-
|
|
4138
|
+
printTriageSteps(branch);
|
|
4139
|
+
}
|
|
4140
|
+
function printTriageSteps(branch) {
|
|
4141
|
+
console.info(colors_default.dim(`staying on '${branch}' without pushing.`));
|
|
4142
|
+
console.info(colors_default.dim(" run drift triage (`pnpm cella analyze`), commit any follow-ups, then:"));
|
|
4143
|
+
console.info(colors_default.dim(" pnpm cella sync (pushes the branch and opens the PR)"));
|
|
4141
4144
|
}
|
|
4142
4145
|
async function mergeOpenSyncPrs(config, open) {
|
|
4143
4146
|
const { forkPath, settings } = config;
|
|
@@ -4202,7 +4205,7 @@ async function runSyncCommand(config) {
|
|
|
4202
4205
|
const currentBranch = await getCurrentBranch(forkPath);
|
|
4203
4206
|
const onSyncBranch = isTemporarySyncBranch(currentBranch);
|
|
4204
4207
|
if (onSyncBranch && mergeInProgress(forkPath)) {
|
|
4205
|
-
await
|
|
4208
|
+
await commitSyncMerge(config, currentBranch);
|
|
4206
4209
|
return;
|
|
4207
4210
|
}
|
|
4208
4211
|
if (onSyncBranch) {
|
|
@@ -4231,9 +4234,11 @@ commit them first (\`git commit --amend --no-edit\` or a new commit).`
|
|
|
4231
4234
|
if (outcome.status === "conflicts") {
|
|
4232
4235
|
console.info(`${warningMark} ${colors_default.yellow(`conflicts on '${temporaryBranch}'. Resolve and stage them, then:`)}`);
|
|
4233
4236
|
printFinishSteps();
|
|
4234
|
-
console.info(colors_default.dim(" rerun commits the sync
|
|
4237
|
+
console.info(colors_default.dim(" rerun commits the sync and stops for drift triage; a further rerun ships (push + PR)."));
|
|
4235
4238
|
console.info(colors_default.dim(" let the rerun commit \u2014 a manual `git commit` records a merge commit that bloats the PR."));
|
|
4239
|
+
return;
|
|
4236
4240
|
}
|
|
4241
|
+
await commitSyncMerge(config, temporaryBranch);
|
|
4237
4242
|
}
|
|
4238
4243
|
|
|
4239
4244
|
// src/services/forks.ts
|