@memfork/cli 0.1.25 → 0.1.26
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/commands/ops.js +3 -23
- package/package.json +2 -2
package/dist/commands/ops.js
CHANGED
|
@@ -14,26 +14,6 @@ async function getClient() {
|
|
|
14
14
|
const client = await MemForksClient.connect(toClientConfig(cfg));
|
|
15
15
|
return { client, cfg };
|
|
16
16
|
}
|
|
17
|
-
function isTransientSuiError(e) {
|
|
18
|
-
const msg = String(e);
|
|
19
|
-
return (msg.includes("needs to be rebuilt") ||
|
|
20
|
-
msg.includes("unavailable for consumption") ||
|
|
21
|
-
msg.includes("object version"));
|
|
22
|
-
}
|
|
23
|
-
async function withRetry(fn, retries = 2, delayMs = 1500) {
|
|
24
|
-
for (let attempt = 1;; attempt++) {
|
|
25
|
-
try {
|
|
26
|
-
return await fn();
|
|
27
|
-
}
|
|
28
|
-
catch (e) {
|
|
29
|
-
if (isTransientSuiError(e) && attempt < retries) {
|
|
30
|
-
await new Promise((r) => setTimeout(r, delayMs));
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
throw e;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
17
|
function currentGitBranch() {
|
|
38
18
|
try {
|
|
39
19
|
return execSync("git rev-parse --abbrev-ref HEAD", { encoding: "utf8" }).trim();
|
|
@@ -132,7 +112,7 @@ export async function cmdCommit(opts) {
|
|
|
132
112
|
console.error(chalk.red("No facts to commit. Pass --facts or --from-response."));
|
|
133
113
|
process.exit(1);
|
|
134
114
|
}
|
|
135
|
-
const { blobId } = await
|
|
115
|
+
const { blobId } = await client.commit(branch, { facts, message: opts.message });
|
|
136
116
|
const out = { blobId, branch };
|
|
137
117
|
if (process.stdout.isTTY) {
|
|
138
118
|
console.log("");
|
|
@@ -158,7 +138,7 @@ export async function cmdMerge(from, into, opts) {
|
|
|
158
138
|
process.stdout.write(chalk.dim(`Merging ${chalk.green(from)} → ${chalk.green(into)}`) +
|
|
159
139
|
chalk.dim(governed ? " (governed — awaiting resolver…)" : " (LWW — self-finalizing…)") +
|
|
160
140
|
" ");
|
|
161
|
-
const { digest, mergedCount, blobId, proposalId } = await
|
|
141
|
+
const { digest, mergedCount, blobId, proposalId } = await client.merge(from, into);
|
|
162
142
|
console.log(chalk.green("done"));
|
|
163
143
|
console.log("");
|
|
164
144
|
console.log(chalk.dim(` facts merged: ${mergedCount}`));
|
|
@@ -594,7 +574,7 @@ export async function cmdBranch(name, opts = {}) {
|
|
|
594
574
|
const { client, cfg } = await getClient();
|
|
595
575
|
const from = opts.from ?? cfg.defaultBranch ?? currentGitBranch();
|
|
596
576
|
process.stdout.write(chalk.dim(`Creating branch ${chalk.green(name)} from ${chalk.green(from)} … `));
|
|
597
|
-
const digest = await
|
|
577
|
+
const digest = await client.branch(name, { from });
|
|
598
578
|
console.log(chalk.green("done"));
|
|
599
579
|
console.log("");
|
|
600
580
|
console.log(chalk.dim(` tx: ${digest}`));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memfork/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.26",
|
|
4
4
|
"description": "MemForks CLI — init, commit, recall, merge, install plugins",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@inquirer/prompts": "^8.5.2",
|
|
38
|
-
"@memfork/core": "^0.1.
|
|
38
|
+
"@memfork/core": "^0.1.11",
|
|
39
39
|
"chalk": "^5.6.2",
|
|
40
40
|
"commander": "^15.0.0"
|
|
41
41
|
},
|