unforgit 0.11.2 → 0.11.3
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/{chunk-AI6MKGCF.js → chunk-IYCICAXZ.js} +110 -26
- package/dist/chunk-IYCICAXZ.js.map +1 -0
- package/dist/index.js +59 -13
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-AI6MKGCF.js.map +0 -1
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-IYCICAXZ.js";
|
|
39
39
|
|
|
40
40
|
// src/index.ts
|
|
41
41
|
import { Command as Command32 } from "commander";
|
|
@@ -2064,13 +2064,21 @@ var pushCommand = new Command16("push").description("Push local memories to remo
|
|
|
2064
2064
|
const client = new RemoteClient(config.remote.url);
|
|
2065
2065
|
const pendingPush = store.getPendingPush();
|
|
2066
2066
|
const untracked = opts.all ? store.getUntrackedMemories(orgId, repoId) : [];
|
|
2067
|
-
|
|
2067
|
+
const untrackedToPush = untracked.filter((memory) => memory.status !== "deprecated");
|
|
2068
|
+
for (const memory of untrackedToPush) {
|
|
2068
2069
|
store.initSyncStateForMemory(memory.id);
|
|
2069
2070
|
}
|
|
2070
|
-
const allToPush = opts.all ? [...pendingPush, ...
|
|
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;
|
|
2073
|
+
if (memory.status === "superseded" && (syncState.remoteVersion !== void 0 || syncState.lastPushedAt || syncState.lastPulledAt)) {
|
|
2074
|
+
return false;
|
|
2075
|
+
}
|
|
2076
|
+
return true;
|
|
2077
|
+
});
|
|
2078
|
+
const supersededToSync = store.getSupersededMemoriesToSync(orgId, repoId).filter(({ memory }) => memory.visibility === "repo" || opts.force);
|
|
2079
|
+
const deprecatedToSync = store.getDeprecatedMemoriesToSync(orgId, repoId).filter((memory) => memory.visibility === "repo" || opts.force);
|
|
2072
2080
|
const linksToSync = store.getLinksToSync(orgId, repoId);
|
|
2073
|
-
if (allToPush.length === 0 && supersededToSync.length === 0 && linksToSync.length === 0) {
|
|
2081
|
+
if (allToPush.length === 0 && supersededToSync.length === 0 && deprecatedToSync.length === 0 && linksToSync.length === 0) {
|
|
2074
2082
|
logger.info("Everything up-to-date");
|
|
2075
2083
|
return;
|
|
2076
2084
|
}
|
|
@@ -2088,6 +2096,12 @@ var pushCommand = new Command16("push").description("Push local memories to remo
|
|
|
2088
2096
|
logger.info(` ${memory.id.slice(0, 8)}... -> superseded by ${newId.slice(0, 8)}...`);
|
|
2089
2097
|
}
|
|
2090
2098
|
}
|
|
2099
|
+
if (deprecatedToSync.length > 0) {
|
|
2100
|
+
logger.info("\nWould sync deprecated status:");
|
|
2101
|
+
for (const memory of deprecatedToSync) {
|
|
2102
|
+
logger.info(` ${memory.id.slice(0, 8)}... -> deprecated`);
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2091
2105
|
if (linksToSync.length > 0) {
|
|
2092
2106
|
logger.info("\nWould sync links:");
|
|
2093
2107
|
for (const { link } of linksToSync) {
|
|
@@ -2095,7 +2109,7 @@ var pushCommand = new Command16("push").description("Push local memories to remo
|
|
|
2095
2109
|
}
|
|
2096
2110
|
}
|
|
2097
2111
|
logger.info(`
|
|
2098
|
-
Total: ${allToPush.length} memories, ${supersededToSync.length} status updates, ${linksToSync.length} links`);
|
|
2112
|
+
Total: ${allToPush.length} memories, ${supersededToSync.length + deprecatedToSync.length} status updates, ${linksToSync.length} links`);
|
|
2099
2113
|
return;
|
|
2100
2114
|
}
|
|
2101
2115
|
let pushed = 0;
|
|
@@ -2104,6 +2118,10 @@ Total: ${allToPush.length} memories, ${supersededToSync.length} status updates,
|
|
|
2104
2118
|
try {
|
|
2105
2119
|
const fullMemory = store.getById(memory.id);
|
|
2106
2120
|
if (!fullMemory) continue;
|
|
2121
|
+
if (fullMemory.version !== memory.version || fullMemory.status !== memory.status) {
|
|
2122
|
+
logger.info(` ${memory.id.slice(0, 8)}... changed locally before push; update remains pending`);
|
|
2123
|
+
continue;
|
|
2124
|
+
}
|
|
2107
2125
|
if (fullMemory.visibility !== "repo" && !opts.force) {
|
|
2108
2126
|
logger.info(` Skipping ${memory.id.slice(0, 8)}... (private memory, use --force to push anyway)`);
|
|
2109
2127
|
continue;
|
|
@@ -2123,10 +2141,13 @@ Total: ${allToPush.length} memories, ${supersededToSync.length} status updates,
|
|
|
2123
2141
|
authorId: fullMemory.authorId,
|
|
2124
2142
|
authorName: fullMemory.authorName
|
|
2125
2143
|
});
|
|
2126
|
-
store.markAsPushed(memory.id, fullMemory.version)
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2144
|
+
if (store.markAsPushed(memory.id, fullMemory.version, fullMemory.version)) {
|
|
2145
|
+
pushed++;
|
|
2146
|
+
logger.progress(pushed + errors, allToPush.length, "memories");
|
|
2147
|
+
logger.debug(`pushed ${memory.id.slice(0, 8)}...`);
|
|
2148
|
+
} else {
|
|
2149
|
+
logger.info(` ${memory.id.slice(0, 8)}... changed locally during push; update remains pending`);
|
|
2150
|
+
}
|
|
2130
2151
|
} catch (err) {
|
|
2131
2152
|
errors++;
|
|
2132
2153
|
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
@@ -2145,9 +2166,12 @@ Total: ${allToPush.length} memories, ${supersededToSync.length} status updates,
|
|
|
2145
2166
|
for (const { memory, newId } of supersededToSync) {
|
|
2146
2167
|
try {
|
|
2147
2168
|
await client.supersede(memory.id, newId);
|
|
2148
|
-
store.markStatusSynced(memory.id)
|
|
2149
|
-
|
|
2150
|
-
|
|
2169
|
+
if (store.markStatusSynced(memory.id, memory.version)) {
|
|
2170
|
+
supersededSynced++;
|
|
2171
|
+
logger.info(` ${memory.id.slice(0, 8)}... marked as superseded on remote`);
|
|
2172
|
+
} else {
|
|
2173
|
+
logger.info(` ${memory.id.slice(0, 8)}... changed locally during push; update remains pending`);
|
|
2174
|
+
}
|
|
2151
2175
|
} catch (err) {
|
|
2152
2176
|
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
2153
2177
|
if (!errorMsg.includes("404")) {
|
|
@@ -2156,6 +2180,25 @@ Total: ${allToPush.length} memories, ${supersededToSync.length} status updates,
|
|
|
2156
2180
|
}
|
|
2157
2181
|
}
|
|
2158
2182
|
}
|
|
2183
|
+
let deprecatedSynced = 0;
|
|
2184
|
+
for (const memory of deprecatedToSync) {
|
|
2185
|
+
try {
|
|
2186
|
+
const reason = typeof memory.sourceRefs?.deprecation_reason === "string" ? memory.sourceRefs.deprecation_reason : void 0;
|
|
2187
|
+
await client.deprecate(memory.id, reason);
|
|
2188
|
+
if (store.markStatusSynced(memory.id, memory.version)) {
|
|
2189
|
+
deprecatedSynced++;
|
|
2190
|
+
logger.info(` ${memory.id.slice(0, 8)}... marked as deprecated on remote`);
|
|
2191
|
+
} else {
|
|
2192
|
+
logger.info(` ${memory.id.slice(0, 8)}... changed locally during push; update remains pending`);
|
|
2193
|
+
}
|
|
2194
|
+
} catch (err) {
|
|
2195
|
+
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
2196
|
+
if (!errorMsg.includes("404")) {
|
|
2197
|
+
errors++;
|
|
2198
|
+
logger.error(` ${memory.id.slice(0, 8)}... failed to sync deprecated status: ${errorMsg}`);
|
|
2199
|
+
}
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2159
2202
|
let linksSynced = 0;
|
|
2160
2203
|
for (const { link } of linksToSync) {
|
|
2161
2204
|
try {
|
|
@@ -2178,6 +2221,9 @@ Total: ${allToPush.length} memories, ${supersededToSync.length} status updates,
|
|
|
2178
2221
|
if (supersededSynced > 0) {
|
|
2179
2222
|
logger.info(`${supersededSynced} memory(s) marked as superseded on remote`);
|
|
2180
2223
|
}
|
|
2224
|
+
if (deprecatedSynced > 0) {
|
|
2225
|
+
logger.info(`${deprecatedSynced} memory(s) marked as deprecated on remote`);
|
|
2226
|
+
}
|
|
2181
2227
|
if (linksSynced > 0) {
|
|
2182
2228
|
logger.info(`${linksSynced} link(s) synced`);
|
|
2183
2229
|
}
|