@magic-markdown/cli 0.3.24 → 0.3.25
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 +12 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -293,7 +293,6 @@ function isMdocsError(error) {
|
|
|
293
293
|
}
|
|
294
294
|
|
|
295
295
|
// ../core/src/ids.ts
|
|
296
|
-
import { createHash } from "node:crypto";
|
|
297
296
|
function createId(prefix) {
|
|
298
297
|
const id = globalThis.crypto?.randomUUID?.() ?? fallbackRandomId();
|
|
299
298
|
return `${prefix}_${id.replaceAll("-", "").slice(0, 24)}`;
|
|
@@ -303,8 +302,8 @@ function createDocId() {
|
|
|
303
302
|
}
|
|
304
303
|
var DOC_ID_SEPARATOR = "\0";
|
|
305
304
|
function deterministicDocId(rootId, path) {
|
|
306
|
-
const digest =
|
|
307
|
-
return `doc_${digest
|
|
305
|
+
const digest = fnv1a(`${rootId}${DOC_ID_SEPARATOR}${path}`).toString(16).padStart(16, "0");
|
|
306
|
+
return `doc_${digest}`;
|
|
308
307
|
}
|
|
309
308
|
function contentHashForText(value) {
|
|
310
309
|
return `text_${fnv1a(value).toString(16).padStart(16, "0")}`;
|
|
@@ -10791,7 +10790,7 @@ function validatePatchOpsShape(ops) {
|
|
|
10791
10790
|
}
|
|
10792
10791
|
|
|
10793
10792
|
// src/agent.ts
|
|
10794
|
-
var CLI_VERSION = "0.3.
|
|
10793
|
+
var CLI_VERSION = "0.3.25";
|
|
10795
10794
|
var CLI_PACKAGE_NAME = "@magic-markdown/cli";
|
|
10796
10795
|
var AGENT_COMMANDS = [
|
|
10797
10796
|
{
|
|
@@ -12372,7 +12371,7 @@ function parseRange(value) {
|
|
|
12372
12371
|
}
|
|
12373
12372
|
|
|
12374
12373
|
// src/remote-join-store.ts
|
|
12375
|
-
import { createHash
|
|
12374
|
+
import { createHash } from "node:crypto";
|
|
12376
12375
|
import { mkdir as mkdir3, readFile as readFile5, readdir as readdir3, writeFile as writeFile3 } from "node:fs/promises";
|
|
12377
12376
|
import { join as join3 } from "node:path";
|
|
12378
12377
|
async function readSelectedJoin(root, flags) {
|
|
@@ -12406,7 +12405,7 @@ async function writeJoinRecord(root, record) {
|
|
|
12406
12405
|
`, "utf8");
|
|
12407
12406
|
}
|
|
12408
12407
|
function joinIdFor(value) {
|
|
12409
|
-
return `join_${
|
|
12408
|
+
return `join_${createHash("sha256").update(value).digest("hex").slice(0, 16)}`;
|
|
12410
12409
|
}
|
|
12411
12410
|
function looksLikeUrl(value) {
|
|
12412
12411
|
try {
|
|
@@ -13169,7 +13168,7 @@ function optionalFolderTarget(value) {
|
|
|
13169
13168
|
}
|
|
13170
13169
|
|
|
13171
13170
|
// src/bridge.ts
|
|
13172
|
-
import { createHash as
|
|
13171
|
+
import { createHash as createHash2, randomUUID as randomUUID3 } from "node:crypto";
|
|
13173
13172
|
import { unlinkSync } from "node:fs";
|
|
13174
13173
|
import { chmod, mkdir as mkdir4, readFile as readFile6, rm as rm3, writeFile as writeFile4 } from "node:fs/promises";
|
|
13175
13174
|
import { homedir } from "node:os";
|
|
@@ -13288,7 +13287,7 @@ async function runBridge(options) {
|
|
|
13288
13287
|
}
|
|
13289
13288
|
const localManifestSource = await readLocalSource(root);
|
|
13290
13289
|
const rootId = options.rootId ?? options.sourceId ?? localManifestSource?.sourceId ?? rootIdForPath(root);
|
|
13291
|
-
const replicaId = `replica_${
|
|
13290
|
+
const replicaId = `replica_${createHash2("sha256").update(`${root}:${options.actorId}`).digest("hex").slice(0, 12)}`;
|
|
13292
13291
|
const replicaKind = actorKindForBridge(options.actorId) === "agent" ? "agent_runtime" : "local";
|
|
13293
13292
|
const mapping = createSourceMapping({
|
|
13294
13293
|
sourceId: rootId,
|
|
@@ -14027,7 +14026,7 @@ async function readBridgeTokenStore() {
|
|
|
14027
14026
|
return { schemaVersion: 1, tokens: {} };
|
|
14028
14027
|
}
|
|
14029
14028
|
function bridgeTokenStoreKey(options, rootId) {
|
|
14030
|
-
return
|
|
14029
|
+
return createHash2("sha256").update(JSON.stringify([normalizeBridgeBaseUrl(options.baseUrl), options.workspaceId, rootId, options.actorId])).digest("hex").slice(0, 32);
|
|
14031
14030
|
}
|
|
14032
14031
|
function normalizeBridgeBaseUrl(baseUrl) {
|
|
14033
14032
|
try {
|
|
@@ -14215,7 +14214,7 @@ function mergeReplicas(replicas, replica) {
|
|
|
14215
14214
|
return [...replicas.filter((candidate) => candidate.replicaId !== replica.replicaId), replica];
|
|
14216
14215
|
}
|
|
14217
14216
|
function rootIdForPath(path) {
|
|
14218
|
-
return `root_${
|
|
14217
|
+
return `root_${createHash2("sha256").update(path).digest("hex").slice(0, 12)}`;
|
|
14219
14218
|
}
|
|
14220
14219
|
function conflictCopyPath(path, stamp = conflictCopyStamp()) {
|
|
14221
14220
|
return path.replace(/(\.[^./]+)?$/, (extension) => `.conflict-${stamp}${extension || ".md"}`);
|
|
@@ -14272,7 +14271,7 @@ function isProcessAlive(pid) {
|
|
|
14272
14271
|
}
|
|
14273
14272
|
}
|
|
14274
14273
|
function hashJson(value) {
|
|
14275
|
-
return
|
|
14274
|
+
return createHash2("sha256").update(JSON.stringify(value)).digest("hex");
|
|
14276
14275
|
}
|
|
14277
14276
|
function documentSignature(markdown) {
|
|
14278
14277
|
return hashJson({ markdown });
|
|
@@ -14304,7 +14303,7 @@ function readDocumentPayload(payload) {
|
|
|
14304
14303
|
|
|
14305
14304
|
// src/bridge-startup.ts
|
|
14306
14305
|
import { execFile as execFile2 } from "node:child_process";
|
|
14307
|
-
import { createHash as
|
|
14306
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
14308
14307
|
import { chmod as chmod2, copyFile, mkdir as mkdir5, readFile as readFile7, stat as stat3, writeFile as writeFile5 } from "node:fs/promises";
|
|
14309
14308
|
import { homedir as homedir2, platform } from "node:os";
|
|
14310
14309
|
import { dirname as dirname5, join as join5, resolve as resolve5 } from "node:path";
|
|
@@ -14500,7 +14499,7 @@ WantedBy=default.target
|
|
|
14500
14499
|
`;
|
|
14501
14500
|
}
|
|
14502
14501
|
function serviceLabel(root) {
|
|
14503
|
-
const digest =
|
|
14502
|
+
const digest = createHash3("sha256").update(root).digest("hex").slice(0, 12);
|
|
14504
14503
|
return `com.magic-markdown.bridge.${digest}`;
|
|
14505
14504
|
}
|
|
14506
14505
|
async function runOptionalCommand(command, args) {
|
package/package.json
CHANGED