sidecarsync 2.0.0 → 2.0.1
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 -3
- package/dist/cli.js +20 -16
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="https://raw.githubusercontent.com/
|
|
2
|
+
<img src="https://raw.githubusercontent.com/endograph/sidecar/main/packages/marketing/branding/readme-hero.svg" alt="sidecar" width="420" />
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
|
-
<a href="https://
|
|
6
|
+
<a href="https://endograph.github.io/sidecar/">Website</a> ·
|
|
7
7
|
<a href="#quickstart">Quickstart</a> ·
|
|
8
8
|
<a href="docs/commands.md">Commands</a> ·
|
|
9
9
|
<a href="https://www.npmjs.com/package/sidecarsync">npm</a>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
# sidecar
|
|
13
13
|
|
|
14
|
-
[](https://github.com/endograph/sidecar/actions/workflows/ci.yml)
|
|
15
15
|
[](https://www.npmjs.com/package/sidecarsync)
|
|
16
16
|
[](LICENSE)
|
|
17
17
|
[](https://nodejs.org)
|
package/dist/cli.js
CHANGED
|
@@ -4815,7 +4815,7 @@ function bootstrapMainBranch(repo, config) {
|
|
|
4815
4815
|
|
|
4816
4816
|
Scratch space for a code repository: plans, notes, and agent context.
|
|
4817
4817
|
This is a plain git repo you own — read it, edit it, clone it anywhere.
|
|
4818
|
-
Kept in sync by [sidecar](https://github.com/
|
|
4818
|
+
Kept in sync by [sidecar](https://github.com/endograph/sidecar).
|
|
4819
4819
|
`, "utf8");
|
|
4820
4820
|
git(repo, ["add", "README.md"]);
|
|
4821
4821
|
git(repo, ["commit", "-m", "Initialize sidecar"]);
|
|
@@ -5209,7 +5209,8 @@ function resolveLastWriterWins(repo, canonicalBranch, remoteBranch, selectedPath
|
|
|
5209
5209
|
const oursChanged = oursWrite.source !== baseWrite.source;
|
|
5210
5210
|
const theirsChanged = theirsWrite.source !== baseWrite.source;
|
|
5211
5211
|
const incoming = oursChanged !== theirsChanged ? theirsChanged : theirsAt > oursAt || theirsAt === oursAt && entryKey(theirs) > entryKey(ours);
|
|
5212
|
-
|
|
5212
|
+
const conflict = oursChanged && theirsChanged && entryKey(ours) !== entryKey(theirs);
|
|
5213
|
+
return { filePath, ours, theirs, incoming, conflict, winner: incoming ? theirs : ours, write: incoming ? theirsWrite : oursWrite };
|
|
5213
5214
|
});
|
|
5214
5215
|
const selected = new Set(selections.map((entry) => entry.filePath));
|
|
5215
5216
|
const indexed = new Set(git(repo, ["ls-files", "-z"]).stdout.split("\x00").filter(Boolean));
|
|
@@ -5229,30 +5230,33 @@ function resolveLastWriterWins(repo, canonicalBranch, remoteBranch, selectedPath
|
|
|
5229
5230
|
}
|
|
5230
5231
|
}
|
|
5231
5232
|
const written = [];
|
|
5232
|
-
for (const { filePath, ours, theirs, incoming, winner, write } of selections) {
|
|
5233
|
+
for (const { filePath, ours, theirs, incoming, conflict, winner, write } of selections) {
|
|
5233
5234
|
if (winner) {
|
|
5234
5235
|
git(repo, ["restore", `--source=${incoming ? remoteBranch : "HEAD"}`, "--staged", "--worktree", "--", `:(literal)${filePath}`]);
|
|
5235
5236
|
git(repo, ["add", "--renormalize", "--", `:(literal)${filePath}`]);
|
|
5236
5237
|
}
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5238
|
+
if (conflict)
|
|
5239
|
+
manifest.paths.push({
|
|
5240
|
+
path: filePath,
|
|
5241
|
+
kept: incoming ? branch : canonicalBranch,
|
|
5242
|
+
kept_at: write.time,
|
|
5243
|
+
dropped: incoming ? canonicalBranch : branch,
|
|
5244
|
+
dropped_oid: (incoming ? ours : theirs)?.oid ?? null
|
|
5245
|
+
});
|
|
5244
5246
|
written.push(lwwWrittenTrailer(filePath, write));
|
|
5245
5247
|
}
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5248
|
+
if (manifest.paths.length) {
|
|
5249
|
+
const manifestDir = path8.join(repo, ".sidecar-conflicts");
|
|
5250
|
+
fs8.mkdirSync(manifestDir, { recursive: true });
|
|
5251
|
+
const manifestPath = path8.join(manifestDir, `${timestamp}-${fileLabel(branch)}-lww.json`);
|
|
5252
|
+
fs8.writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}
|
|
5250
5253
|
`, "utf8");
|
|
5251
|
-
|
|
5254
|
+
git(repo, ["add", "--", `:(literal)${path8.relative(repo, manifestPath)}`]);
|
|
5255
|
+
}
|
|
5252
5256
|
if (Object.keys(selectConflictPaths(unmergedPaths(repo), selectedPaths)).length) {
|
|
5253
5257
|
throw new SidecarError("last-writer-wins did not clear all unmerged paths");
|
|
5254
5258
|
}
|
|
5255
|
-
console.log(`selected ${
|
|
5259
|
+
console.log(`selected ${selections.length} complete file version(s) by last writer`);
|
|
5256
5260
|
return written;
|
|
5257
5261
|
}
|
|
5258
5262
|
function entryKey(entry) {
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sidecarsync",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "A Git-backed sidecar inbox for repo-local development metadata.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/
|
|
8
|
+
"url": "git+https://github.com/endograph/sidecar.git",
|
|
9
9
|
"directory": "packages/sidecar"
|
|
10
10
|
},
|
|
11
11
|
"publishConfig": {
|
|
@@ -45,5 +45,9 @@
|
|
|
45
45
|
"ignore": "^7.0.8",
|
|
46
46
|
"picomatch": "^4.0.5",
|
|
47
47
|
"smol-toml": "^1.7.0"
|
|
48
|
+
},
|
|
49
|
+
"homepage": "https://github.com/endograph/sidecar/tree/main/packages/sidecar#readme",
|
|
50
|
+
"bugs": {
|
|
51
|
+
"url": "https://github.com/endograph/sidecar/issues"
|
|
48
52
|
}
|
|
49
53
|
}
|