omnispace 0.3.0 → 0.3.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/dist/pull.js +30 -8
- package/package.json +39 -39
package/dist/pull.js
CHANGED
|
@@ -121,13 +121,24 @@ async function pruneEmptyDirs(root, path) {
|
|
|
121
121
|
parts.pop();
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
function listSome(paths, max = 20) {
|
|
124
|
+
function listSome(paths, max = 20, out = console.error) {
|
|
125
125
|
for (const path of paths.slice(0, max))
|
|
126
|
-
|
|
126
|
+
out(` ${path}`);
|
|
127
127
|
if (paths.length > max)
|
|
128
|
-
|
|
128
|
+
out(` ... e mais ${paths.length - max}`);
|
|
129
|
+
}
|
|
130
|
+
/** Local changes not on the server yet, one per line, marking the ones deleted here. */
|
|
131
|
+
function listPending(paths, local) {
|
|
132
|
+
listSome(paths.map((p) => (local.has(p) ? ` ${p}` : ` ${p} (apagado aqui)`)), 20, console.log);
|
|
129
133
|
}
|
|
130
134
|
export const CONFLICT_CHOICES = ["local", "mesclar", "backup"];
|
|
135
|
+
/** Files a pull wrote or removed, counting the ones settled by merge, backup or a conflict choice. */
|
|
136
|
+
export function countApplied(plan, resolutions) {
|
|
137
|
+
return {
|
|
138
|
+
written: plan.writes.length + resolutions.filter((r) => !r.remove && (r.hash !== undefined || r.text !== undefined)).length,
|
|
139
|
+
deleted: plan.deletes.length + resolutions.filter((r) => r.remove).length,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
131
142
|
/** The question for each kind of conflict, with one label per choice (local, mesclar, backup). */
|
|
132
143
|
function promptFor(conflict) {
|
|
133
144
|
switch (conflict.kind) {
|
|
@@ -275,7 +286,9 @@ async function pullWith(root, config, token, opts, asker) {
|
|
|
275
286
|
else
|
|
276
287
|
console.log(`✓ Esta pasta já está na versão ${head}, a mais nova do servidor.\n`);
|
|
277
288
|
if (plan.localOnly.length > 0) {
|
|
278
|
-
console.log(` ${plan.localOnly.length} mudança(s) local(is) ainda não enviada(s)
|
|
289
|
+
console.log(` ${plan.localOnly.length} mudança(s) local(is) ainda não enviada(s):`);
|
|
290
|
+
listPending(plan.localOnly, local);
|
|
291
|
+
console.log(" Envie com omni sync --push.\n");
|
|
279
292
|
}
|
|
280
293
|
return 0;
|
|
281
294
|
}
|
|
@@ -412,7 +425,8 @@ async function pullWith(root, config, token, opts, asker) {
|
|
|
412
425
|
const ack = await callApi(config.apiUrl, token, "/api/cli/sync/ack", { spaceId: config.spaceId, version: head });
|
|
413
426
|
if (!ack.ok)
|
|
414
427
|
console.error(`(aviso) A pasta está na versão ${head}, mas o servidor não registrou: ${ack.error}`);
|
|
415
|
-
|
|
428
|
+
const applied = countApplied(plan, resolutions);
|
|
429
|
+
console.log(`✓ Pasta na versão ${head}: ${applied.written} arquivo(s) gravado(s), ${applied.deleted} apagado(s).`);
|
|
416
430
|
if (autoMerged > 0)
|
|
417
431
|
console.log(` ${autoMerged} arquivo(s) mudaram dos dois lados e foram juntados sozinhos.`);
|
|
418
432
|
if (backedUp.length > 0) {
|
|
@@ -423,9 +437,17 @@ async function pullWith(root, config, token, opts, asker) {
|
|
|
423
437
|
for (const path of marked)
|
|
424
438
|
console.log(` ${path}`);
|
|
425
439
|
}
|
|
426
|
-
const pendingPush =
|
|
427
|
-
|
|
428
|
-
|
|
440
|
+
const pendingPush = [
|
|
441
|
+
...plan.localOnly,
|
|
442
|
+
...resolutions.filter((r) => r.pendingPush && !r.markers).map((r) => r.path),
|
|
443
|
+
].sort();
|
|
444
|
+
if (pendingPush.length > 0 && marked.length === 0) {
|
|
445
|
+
const afterPull = new Map(local);
|
|
446
|
+
for (const r of resolutions)
|
|
447
|
+
if (r.remove)
|
|
448
|
+
afterPull.delete(r.path);
|
|
449
|
+
console.log(` ${pendingPush.length} mudança(s) desta máquina ainda não estão no servidor:`);
|
|
450
|
+
listPending(pendingPush, afterPull);
|
|
429
451
|
if (process.stdin.isTTY && !opts.conflito) {
|
|
430
452
|
const answer = await asker.ask("Enviar agora? (s/n) ");
|
|
431
453
|
if (answer === "s" || answer === "sim")
|
package/package.json
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "omnispace",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"description": "Omni CLI (alpha): transforma uma pasta da sua máquina em um espaço Omni e sincroniza entre máquinas.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"bin": {
|
|
7
|
-
"omni": "dist/index.js",
|
|
8
|
-
"omnispace": "dist/index.js"
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"dist",
|
|
12
|
-
"README.md"
|
|
13
|
-
],
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "tsc -p tsconfig.json",
|
|
16
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
17
|
-
"omni": "node dist/index.js",
|
|
18
|
-
"test": "tsc -p tsconfig.test.json && node --test \".test-build/test/**/*.test.js\""
|
|
19
|
-
},
|
|
20
|
-
"engines": {
|
|
21
|
-
"node": ">=20"
|
|
22
|
-
},
|
|
23
|
-
"keywords": [
|
|
24
|
-
"omni",
|
|
25
|
-
"tzolkin",
|
|
26
|
-
"ai",
|
|
27
|
-
"agent",
|
|
28
|
-
"sync",
|
|
29
|
-
"knowledge-base",
|
|
30
|
-
"cli"
|
|
31
|
-
],
|
|
32
|
-
"homepage": "https://omni.tzolkin.cloud",
|
|
33
|
-
"license": "UNLICENSED",
|
|
34
|
-
"author": "Tzolkin",
|
|
35
|
-
"devDependencies": {
|
|
36
|
-
"@types/node": "^20",
|
|
37
|
-
"typescript": "^5"
|
|
38
|
-
}
|
|
39
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "omnispace",
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"description": "Omni CLI (alpha): transforma uma pasta da sua máquina em um espaço Omni e sincroniza entre máquinas.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"omni": "dist/index.js",
|
|
8
|
+
"omnispace": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc -p tsconfig.json",
|
|
16
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
17
|
+
"omni": "node dist/index.js",
|
|
18
|
+
"test": "tsc -p tsconfig.test.json && node --test \".test-build/test/**/*.test.js\""
|
|
19
|
+
},
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=20"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"omni",
|
|
25
|
+
"tzolkin",
|
|
26
|
+
"ai",
|
|
27
|
+
"agent",
|
|
28
|
+
"sync",
|
|
29
|
+
"knowledge-base",
|
|
30
|
+
"cli"
|
|
31
|
+
],
|
|
32
|
+
"homepage": "https://omni.tzolkin.cloud",
|
|
33
|
+
"license": "UNLICENSED",
|
|
34
|
+
"author": "Tzolkin",
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/node": "^20",
|
|
37
|
+
"typescript": "^5"
|
|
38
|
+
}
|
|
39
|
+
}
|