unforgit 0.11.11 → 0.11.13
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/index.js
CHANGED
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
saveConfig,
|
|
36
36
|
shouldImportMarkdownMemory,
|
|
37
37
|
validateMemoryType
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-IOHA5JJV.js";
|
|
39
39
|
|
|
40
40
|
// src/index.ts
|
|
41
41
|
import { Command as Command32 } from "commander";
|
|
@@ -2069,7 +2069,7 @@ var pushCommand = new Command16("push").description("Push local memories to remo
|
|
|
2069
2069
|
store.initSyncStateForMemory(memory.id);
|
|
2070
2070
|
}
|
|
2071
2071
|
const allToPush = (opts.all ? [...pendingPush, ...untrackedToPush.map((memory) => ({ memory, syncState: store.getSyncState(memory.id) }))] : pendingPush).filter(({ memory, syncState }) => {
|
|
2072
|
-
if (memory.status === "deprecated") return false;
|
|
2072
|
+
if (memory.status === "deprecated" || memory.status === "deleted") return false;
|
|
2073
2073
|
if (memory.status === "superseded" && (syncState.remoteVersion !== void 0 || syncState.lastPushedAt || syncState.lastPulledAt)) {
|
|
2074
2074
|
return false;
|
|
2075
2075
|
}
|
|
@@ -2077,8 +2077,17 @@ var pushCommand = new Command16("push").description("Push local memories to remo
|
|
|
2077
2077
|
});
|
|
2078
2078
|
const supersededToSync = store.getSupersededMemoriesToSync(orgId, repoId).filter(({ memory }) => memory.visibility === "repo" || opts.force);
|
|
2079
2079
|
const deprecatedToSync = store.getDeprecatedMemoriesToSync(orgId, repoId).filter((memory) => memory.visibility === "repo" || opts.force);
|
|
2080
|
+
const tombstonesToSync = store.getUnsyncedTombstones(orgId, repoId).filter((tombstone) => {
|
|
2081
|
+
if (opts.force) return true;
|
|
2082
|
+
const memory = store.getById(tombstone.memoryId);
|
|
2083
|
+
const syncState = store.getSyncState(tombstone.memoryId);
|
|
2084
|
+
const remoteKnowsMemory = Boolean(
|
|
2085
|
+
syncState?.remoteVersion != null || syncState?.lastPushedAt || syncState?.lastPulledAt
|
|
2086
|
+
);
|
|
2087
|
+
return memory?.visibility === "repo" && remoteKnowsMemory;
|
|
2088
|
+
});
|
|
2080
2089
|
const linksToSync = store.getLinksToSync(orgId, repoId);
|
|
2081
|
-
if (allToPush.length === 0 && supersededToSync.length === 0 && deprecatedToSync.length === 0 && linksToSync.length === 0) {
|
|
2090
|
+
if (allToPush.length === 0 && supersededToSync.length === 0 && deprecatedToSync.length === 0 && tombstonesToSync.length === 0 && linksToSync.length === 0) {
|
|
2082
2091
|
logger.info("Everything up-to-date");
|
|
2083
2092
|
return;
|
|
2084
2093
|
}
|
|
@@ -2102,14 +2111,22 @@ var pushCommand = new Command16("push").description("Push local memories to remo
|
|
|
2102
2111
|
logger.info(` ${memory.id.slice(0, 8)}... -> deprecated`);
|
|
2103
2112
|
}
|
|
2104
2113
|
}
|
|
2114
|
+
if (tombstonesToSync.length > 0) {
|
|
2115
|
+
logger.info("\nWould push deletion tombstones:");
|
|
2116
|
+
for (const tombstone of tombstonesToSync) {
|
|
2117
|
+
logger.info(` ${tombstone.memoryId.slice(0, 8)}... -> deleted`);
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
2105
2120
|
if (linksToSync.length > 0) {
|
|
2106
2121
|
logger.info("\nWould sync links:");
|
|
2107
2122
|
for (const { link } of linksToSync) {
|
|
2108
2123
|
logger.info(` ${link.sourceId.slice(0, 8)}... -> ${link.targetId.slice(0, 8)}... (${link.linkType})`);
|
|
2109
2124
|
}
|
|
2110
2125
|
}
|
|
2111
|
-
logger.info(
|
|
2112
|
-
|
|
2126
|
+
logger.info(
|
|
2127
|
+
`
|
|
2128
|
+
Total: ${allToPush.length} memories, ${supersededToSync.length + deprecatedToSync.length} status updates, ${tombstonesToSync.length} deletions, ${linksToSync.length} links`
|
|
2129
|
+
);
|
|
2113
2130
|
return;
|
|
2114
2131
|
}
|
|
2115
2132
|
let pushed = 0;
|
|
@@ -2199,6 +2216,26 @@ Total: ${allToPush.length} memories, ${supersededToSync.length + deprecatedToSyn
|
|
|
2199
2216
|
}
|
|
2200
2217
|
}
|
|
2201
2218
|
}
|
|
2219
|
+
let tombstonesSynced = 0;
|
|
2220
|
+
for (const tombstone of tombstonesToSync) {
|
|
2221
|
+
try {
|
|
2222
|
+
await client.pushTombstone(tombstone);
|
|
2223
|
+
if (store.markTombstoneSynced(tombstone.memoryId, tombstone.id)) {
|
|
2224
|
+
tombstonesSynced++;
|
|
2225
|
+
logger.info(` ${tombstone.memoryId.slice(0, 8)}... deletion pushed to remote`);
|
|
2226
|
+
} else {
|
|
2227
|
+
logger.info(
|
|
2228
|
+
` ${tombstone.memoryId.slice(0, 8)}... deletion changed locally during push; update remains pending`
|
|
2229
|
+
);
|
|
2230
|
+
}
|
|
2231
|
+
} catch (err) {
|
|
2232
|
+
errors++;
|
|
2233
|
+
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
2234
|
+
logger.error(
|
|
2235
|
+
` ${tombstone.memoryId.slice(0, 8)}... failed to push deletion: ${errorMsg}`
|
|
2236
|
+
);
|
|
2237
|
+
}
|
|
2238
|
+
}
|
|
2202
2239
|
let linksSynced = 0;
|
|
2203
2240
|
for (const { link } of linksToSync) {
|
|
2204
2241
|
try {
|
|
@@ -2224,6 +2261,9 @@ Total: ${allToPush.length} memories, ${supersededToSync.length + deprecatedToSyn
|
|
|
2224
2261
|
if (deprecatedSynced > 0) {
|
|
2225
2262
|
logger.info(`${deprecatedSynced} memory(s) marked as deprecated on remote`);
|
|
2226
2263
|
}
|
|
2264
|
+
if (tombstonesSynced > 0) {
|
|
2265
|
+
logger.info(`${tombstonesSynced} deletion(s) pushed successfully`);
|
|
2266
|
+
}
|
|
2227
2267
|
if (linksSynced > 0) {
|
|
2228
2268
|
logger.info(`${linksSynced} link(s) synced`);
|
|
2229
2269
|
}
|